|
-
May 31st, 2005, 02:12 PM
#1
Thread Starter
New Member
Data Bound Grid problem [RESOLVED]
Hey all,
I'm using a data bound grid with an ado data connection. My db is Access '03 using MDAC 2.7. My problem is, after data is entered into the db, the dbg isn't refreshing properly, its always one record behind, i.e. after the first record is entered, the grid is blank, after the second record is entered, the first record displays in the grid. I never had this problem with SQL 2000, but Access is causing me no end of grief with this. Here's the code I'm using to display the grid after each insert:
strSQL = "Select * from MyTable"
AdoTrack.ConnectionString = cnnMydb
AdoTrack.RecordSource = strSQL
AdoTrack.CursorType = adOpenDynamic
AdoTrack.LockType = adLockPessimistic
AdoTrack.Refresh
dbgTrack.ReBind
Any ideas? Thanks in advance.
Last edited by Talarin; Jun 2nd, 2005 at 09:56 AM.
-
May 31st, 2005, 07:41 PM
#2
Re: Data Bound Grid problem
Welcome to VBF!
Give this a try....
VB Code:
AdoTrack.ConnectionString = cnnMydb
AdoTrack.RecordSource = strSQL
AdoTrack.CursorType = adOpenDynamic
[B]AdoTrack.CursorLocation = adUseClient[/B]
AdoTrack.LockType = adLockPessimistic
AdoTrack.Refresh
dbgTrack.ReBind
-
Jun 1st, 2005, 06:22 AM
#3
Thread Starter
New Member
Re: Data Bound Grid problem
Thanks for the welcome 
I added the code as you suggested, still does the same thing. Any other suggestions?
Thanks
-
Jun 2nd, 2005, 09:55 AM
#4
Thread Starter
New Member
Re: Data Bound Grid problem [RESOLVED]
Well, I found a work around for my problem. It's not pretty, but it does the job. Basically, I've found that if I open the recordset and then close it and then open the data grid, the data is all there. Apparently, it's some kind of timing issue, the data grid is fetching faster than the data is posting. It must be something to do with the Access connection string, because I don't have this problem with SQL2000.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|