Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
3.40/5 (2 votes)
Hi,
I'm writing a multiple user C# Windows Application,
my problem comes in if someone else changes/adds a record on their app on their machine,
it is not showing on the other machine unless the tableadapter.fill is called.
If i fill the table adapter on a timer, my listbox is flickering.
Any ideas how i can refresh my data in my dataset without causing delays on the app. Tried backgroundworker aswell with no success.
Somehow i need to see if the dataset is the same as the DB, if not it should update. and with no delays on the application. I am using a Firebird Database.
Thanks
Posted

To refresh dataset You can Reset dataSet and fill it again.
C#
this.YourDataSet.Reset();
this.YourTableAdapter.Fill(this.YourDataSet.table);
 
Share this answer
 
Comments
jpveldtman 26-Jul-11 2:38am    
Thanks for the reply, I did try the fill, but this causes my program not to respond for about 3seconds, and then the Listbox that is populated by the dataset flickers.
This code is without using tableadapter, but with dataadapter.Please clear your dataset with Clear() function and then Fill() the dataset.I have used MS Access Database with OleDB Connection


string con1 = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Documents and Settings\sam\my documents\visual studio 2010\Projects\WindowsFormsApplication1\WindowsFormsApplication1\Database1.accdb";
           string query1 = "SELECT * FROM Table2";
           OleDbDataAdapter da1 = new OleDbDataAdapter(query1, con1);
           OleDbCommandBuilder cmd = new OleDbCommandBuilder(da1);
           da1.Update(database1DataSet2.Table2);
           this.database1DataSet2.Table2.Clear(); //clears the dataset
           da1.Fill(database1DataSet2.Table2);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900