Commit of Record insertion Access.mdb
From: Marc Doolittle (marcd_at_info-link.com)
Date: 01/21/05
- Next message: Jared: "Jet and Batch Updates"
- Previous message: cyourch: "Hard to describe DataRelation"
- Next in thread: Stephen Howe: "Re: Commit of Record insertion Access.mdb"
- Reply: Stephen Howe: "Re: Commit of Record insertion Access.mdb"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 21 Jan 2005 11:12:01 -0500
In vb.net I have a subroutine that calls two functions
Public Sub Test()
InsertRecords()
msgbox(GetCountRecords())
end Sub
Insert records loops through a text file and inserts records into an
Access.mdb table.
GetCountRecords just fills a dataset object with a DataAdapter to return a
count from the Access database of the recently inserted records. The code
is not important I don't thnk- I have changed it 1000 differnet ways and
still get this problem- My problem-
1/10 to 1/2 of the time (randomly) the GetCount procedure returns 0 records
inserted when in fact there were records inserted. If I put a breakpoint in
the da.fill(ds) line that fills the dataset in debug it always returns a
number of records but running the exe it occasionally returns 0. Each
procedure has a separate connection to the database. I have tried multiple
ways to correct this problem. Using transactions, using Datasets to update
the records versus inserting with an SQL command, using DataReaders rather
than filling a dataset. Disposing, forcing garbage collection. The only fix
so far is to put a thread.currentthread.sleep(10000) before the GetCount
procedure. In other words for some reason (threading? Garbage Collecting?)
ADO.net needs to "Wait" until the correct count will return. This solution
is inadequate. Any ideas? Marc
- Next message: Jared: "Jet and Batch Updates"
- Previous message: cyourch: "Hard to describe DataRelation"
- Next in thread: Stephen Howe: "Re: Commit of Record insertion Access.mdb"
- Reply: Stephen Howe: "Re: Commit of Record insertion Access.mdb"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|