Serious failure on OleDbConnection

I am having a serious failure using Access, with OldDbConnection.  I have two program (both WinForms) which read and write to the same table.  I am very careful to enclose all related code for both program in a try catch, and watch the Exceptions table like a hawk.  But every so often it seems like a record disappears, and this problem effects any record.  So I'm wondering if I'm overlooking something in the way I've designed this handshake.

One program produces the records by performing a write.  The other program reads the record and deletes it to show the record's been consumed.

I log the preceding steps leading up to this problem, and see that both programs seem to be acting correctly.  In other words, I see that the program producing the record actully produced it.  And while other orders arrive into the log of the receiving program, sometime a single record (or sometimes two) simply never showed up on the other end.

I also found that I can compress and repair the Access table upon exit, and am now confident that file corruption is not the problem.

Does anyone have any idea about what could cause a record to disappear when no apparent exceptions are thrown?  I'm really at a loss, especially since this is a show stopper for the whole project.

Thanks for the help.

Who is Participating?
rajaloysiousConnect With a Mentor Commented:
You should be deleting records one by one as you read.
delete * from tablename where primarykey1=value and primarykey2=value2

If there is a concept called rowid, it can also be used, but i think it isnt there Access

ba272Author Commented:

I call the function which reads the table, for the receiving program, and pass in a delegate as a parameter.  Could this be a problem?

I designed a standard read function, and empower the function to read data from a host of table formats by call the delegate function which was passed in as a parameter.
just a thought.

While deleting are you deleting the read records one by one or as a group?

if insert records are dummped into a file along with the timestamp
and read records to be deleted are dumped into another file with the timestamp along with the delete statement
 may give you a clue.

There is no way records will vanish from a database table unless you delete them

ba272Author Commented:
Thanks for the input.

I delete them at the end, as a group: DELETE * FROM tablename

I'm right now comenting out everything else in my program, except the order handshake.  I'll  boil it down to that, and hopefuly be able to get it working.  Then I'll carefully add the other code back in, testing all the while.

Yes, I have done some work with a backup table, but I think it's worth me copying the to-be-deleted records to a backup table.

ba272Author Commented:
Would that mean I need to execute another query to delete each record?

DELETE * FROM tablename WHERE ID='32' ?  (for example)

Is there a possibility that I'm deleting new orders with the mre general

DELETE * command?


I think you're right.  New orders which have arrived afterthe first query was made will also be deleted.

Dude, you're my hero.

All Courses

From novice to tech pro — start learning today.