[英]C# SqlDataAdapter.Update()
我为此感到疯狂。 我做了ff:
仔细查看编辑后的数据表,即使我实际上通过datagridview编辑了数据表,但行状态也没有更新,但是编辑的DataRow在item数组中有所变化。 真让人困惑。有什么想法吗? 谢谢。
您需要完成几项工作。 如果从“数据源”视图中拖动表,最终将在GUI上产生一些不同的结果:
有了这些功能,您可以查看源代码,以了解发生在幕后的事情。 您将需要EndEdit(如Baldi之前所述),但还需要更多一点:
private void UpdateGridView()
{
// validate that data types corresponds to database table column
this.Validate();
// ends edit on the graph table
this.graphBindingSource.EndEdit();
// ends edit on the graph table
this.intervalBindingSource.EndEdit();
// connect to the database - and exceute changes
this.tableAdapterManager.UpdateAll(this.diagramDBDataSet);
}
希望这可以帮助您入门。 如果您想了解更多信息-您可以按照此.NET数据库幻灯片放映以及补充的数据库教程进行操作 。 祝好运!
您是否使用DataBinding? 致电EndEdit可能有帮助...!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.