Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: .NET2.0 C# database
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 25-Jul-11 15:30pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

To refresh dataset You can Reset dataSet and fill it again.
this.YourDataSet.Reset();
this.YourTableAdapter.Fill(this.YourDataSet.table);
  Permalink  
Comments
jpveldtman at 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.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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);
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 587
1 Sergey Alexandrovich Kryukov 479
2 Maciej Los 305
3 Mathew Soji 195
4 BillWoodruff 170
0 OriginalGriff 7,356
1 Sergey Alexandrovich Kryukov 6,777
2 DamithSL 5,461
3 Manas Bhardwaj 4,916
4 Maciej Los 4,475


Advertise | Privacy | Mobile
Web04 | 2.8.1411023.1 | Last Updated 19 Jan 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100