Click here to Skip to main content
12,455,917 members (74,573 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: .NET2.0 C# .NET 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 14: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 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
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160826.1 | Last Updated 19 Jan 2014
Copyright © CodeProject, 1999-2016
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