Results 1 to 4 of 4

Thread: Data Bound Grid problem [RESOLVED]

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2005
    Posts
    7

    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.

  2. #2
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Data Bound Grid problem

    Welcome to VBF!

    Give this a try....

    VB Code:
    1. AdoTrack.ConnectionString = cnnMydb
    2. AdoTrack.RecordSource = strSQL
    3. AdoTrack.CursorType = adOpenDynamic
    4. [B]AdoTrack.CursorLocation = adUseClient[/B]
    5. AdoTrack.LockType = adLockPessimistic
    6. AdoTrack.Refresh
    7. dbgTrack.ReBind
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2005
    Posts
    7

    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

  4. #4

    Thread Starter
    New Member
    Join Date
    May 2005
    Posts
    7

    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
  •  



Click Here to Expand Forum to Full Width