Hi!
I'm developing a VB6 application
I've got an ADO Data Control and a Recordset Object pointing to the same
table, now I insert a new record on the ADO Data Control, but that new
record doesn't appears in the Recordset Object even if I call the Requery
method... I'm debugging the application and if I give some delay before the
Requery method it will take the new Record, so the problem seems to be
time... even more, I close the connection and open it again, and it doesn't
works... but if I give a delay, it will work... now... I'm trying to improve
the application performance, so Delaying is not the solution I want...
Here's my code:
Page_Load Code:
...
With mydtaControl
.ConnectionString = mycnn.ConnectionString
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockOptimistic
.RecordSource = "SELECT Code, Name, Inactive FROM Banks WHERE Inactive =
0 ORDER BY Name"
.Refresh
End With
Set rsBankcode = New ADODB.Recordset
With rsBankcode
.LockType = adLockOptimistic
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.Open "SELECT Code FROM Banks WHERE Inactive = 0 ORDER BY Codige", mycnn
End With
...
Update CommandButton Code:
...
dtaBanks.Recordset.Update
mycnn.close
mycnn.open
Set rsBankcode = New ADODB.Recordset
With rsBankcode
.LockType = adLockOptimistic
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.Open "SELECT Code FROM Banks WHERE Inactive = 0 ORDER BY Codige", mycnn
End With
' rsBankCode.Requery
Debug.Print rsBankCode.RecordCount
...
Here's when the problem appears, the RecordCount keeps the same even
Requerying of the Recordset or the refreshing of the connection and the
resetting of the RecordSet...
Any idea of how can I solve this? any suggestion?
Thanks!
Andrés Giraldo
andres_giraldo@yahoo.com
Diederik - 29 Oct 2003 17:33 GMT
Andris Giraldo wrote:
> Hi!
>
[quoted text clipped - 68 lines]
> Andris Giraldo
> andres_giraldo@yahoo.com
I've had the same problem, it only worked in debug mode when setting a
breakpoint at the Requery statement. So I though it was a speed-issue
and added a Sleep statement before the Requery. Didn't help at all.
Now I've rewritten my whole db-component using C++, ATL, OLEDB, STL and
COM and it works perfectly :-)