Help with sync between DataSet and datasource (Fill problem)  
Author Message
bszom





PostPosted: .NET Framework Data Access and Storage, Help with sync between DataSet and datasource (Fill problem) Top

Hi there,

I'm having a weird problem with the fill method.
Basically the structure of my program is:

Fill > Make changes in data source directly through sql statements > Fill again

For some reason the second fill retrieves the same data as the first, as if the changes in the data source have not yet been commited. I'm not using transactions, locks etc etc, everything is very basic.

Each time I fill this is the code:

DataSet.Clear();
DataAdapter.Fill(DataSet, "TableName");

If I put a MessageBox between Clear() and Fill(), forcing a pause, the second fill suddenly "sees" the new records (in the case of an insert, for example).

What could be the cause of this It's causing great headaches! :)

This is OLEDB, with an access database, .NET 1.1

Any help would be much appreciated!

A lengthy description of the problem can be found here, if you are willing to read through some code:
www.experts-exchange.com/Programming/Programming_Languages/C_Sharp/Q_22034798.html


.NET Development17  
 
 
Glenn Block MSFT





PostPosted: .NET Framework Data Access and Storage, Help with sync between DataSet and datasource (Fill problem) Top

Did you try refreshing the grid If you are calling direct SQL statements and they are succedding then most likely your data is getting updated. It seems likely that your grid is simply not showing you the freshed view of the data. Try setting your bindings again after the data is refilled.