Dataadapter.fill删除数据库中的数据保留在数据集中 [英] Dataadapter.fill removed data in the database stays in dataset

查看:96
本文介绍了Dataadapter.fill删除数据库中的数据保留在数据集中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好



我用Google搜索了这个,似乎找不到答案。



我的问题是我使用DataAdapter.fill和.update在pc和数据库之间的数据集之间同步。



我可以通过phpmyadmin改变数据库中的一些数据更新数据集中的数据。



但是如果我删除数据库中该行的数据集中的行。

我是什么?缺少?



我填充这样的数据集

Hi guys

I have googled this and don't seem to find the answer.

My problem is that im using DataAdapter.fill and .update to syncronize between dataset on pc and database.

I can alter some data in the database through phpmyadmin and it updates the data in the dataset.

But if I delete a row in the database that row stays in the dataset.
What am I missing?

I populate the dataset like this

partAdapter = new MySqlDataAdapter("Select * from part", connection);
partBuilder = new MySqlCommandBuilder(partAdapter);
partAdapter.DeleteCommand = partBuilder.GetDeleteCommand();
partAdapter.UpdateCommand = partBuilder.GetUpdateCommand();
partAdapter.InsertCommand = partBuilder.GetInsertCommand();
partAdapter.FillSchema(partTable, SchemaType.Source);
partAdapter.Fill(partTable);

partTable.Merge(dataSet.Tables["partTable"]);





我每30秒更新一次并再次填写





And the every 30 seconds i update and fill again like this

partAdapter.Update(dataSet.Tables["partTable"]);
partAdapter.Fill(dataSet.Tables["partTable"]);





希望有人可以提供帮助



我尝试了什么:



我试过的 - 好吧 - 我用谷歌搜索我是否能找到解决方案 - 但没有运气!



Hope that someone can help

What I have tried:

What I have tried - well - I have googled to see if I could find a solution - but no luck!

推荐答案

我认为你的问题是datatable包含删除的行。尝试从DataTable中删除Row,然后再次填充。
I think you problem is datatable contained deleted row. Try to delete Row from DataTable and then fill it again.


这篇关于Dataadapter.fill删除数据库中的数据保留在数据集中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆