Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / COM / October 2003



Tip: Looking for answers? Try searching our database.

Requerying doesn't works

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Andrés Giraldo - 24 Oct 2003 04:23 GMT
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 :-)
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.