我正在写一个多用户C#Windows应用程序, 如果有人在他们的机器上更改/添加他们的应用程序的记录,我的问题就会出现, 除非调用tableadapter.fill,否则它不显示在另一台机器上。 如果我在计时器上填充表适配器,我的列表框会闪烁。 /> 任何想法如何在我的数据集中刷新我的数据而不会导致应用程序延迟。试过背景工作也没有成功。 不知怎的,我需要看看数据集是否与数据库相同,如果没有它应该更新。并且没有延迟申请。我正在使用Firebird数据库。 谢谢
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
推荐答案刷新数据集您可以重置数据集并重新填充。 To refresh dataset You can Reset dataSet and fill it again. this.YourDataSet.Reset(); this.YourTableAdapter.Fill(this.YourDataSet.table);
此代码不使用tableadapter,但使用dataadapter。请使用Clear()函数清除数据集,然后填充()数据集。我使用了MS Access数据库与OleDB连接 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);
更多推荐
数据集更新或刷新
发布评论