如何用DataSet更形数据库? DataSet.AcceptChanges 方法提交然后dataAdpater. Update 更新数据库详细参考:ms-help://MS.VSCC/MS.MSDNVS.2052/Vbcon/html/vbtskupdatingrecordsindataset.htm 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 SqlCommandBuilder custCB = new SqlCommandBuilder(DataAdapter); DataRow targetRow=dataTable.Rows[listBox1.SelectedIndex]; DataAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey; Application.DoEvents(); targetRow.BeginEdit(); targetRow["title"]=textBox1.Text; targetRow.EndEdit(); DataSet DataSetChange=dataSet.GetChanges(DataRowState.Modified); dataSet.Merge(DataSetChange); DataAdapter.Update(dataSet,"code"); dataSet.AcceptChanges(); Application.DoEvents();这段代码执行之后运行该过程出现错误,但是数据库里的内容却更新了。怎么回事 阿?错误提示:未处理的“System.Data.DBConcurrencyException”类型的异常出现在 system.data.dll 中其他信息:并发冲突:UpdateCommand 影响 0 个记录。 已经搞定,代码如下:try { DataAdapter.Update(dataSet ,"code"); dataSet.AcceptChanges(); } catch (DBConcurrencyException ex) { string customErrorMessage; customErrorMessage = ex.Message; customErrorMessage += ex.Row[0].ToString(); // Replace the above code with appropriate business logic // to resolve the concurrency violation. } WebClient中的DownLoadFile方法 API调用中关于结构指针的问题. SqlParameter问题请高手帮忙修改 如何伪装asp.net和winform用户(详见正文) 求sqlserver数据库连接类 c#与vc6使用com+进行进程间通信的问题 大哥们帮我看看吧 求肋(我系新人,多多关照) 怎样让程序后台运行(显示图标在任务栏) c#用access数据库做的,怎么查询某一段时间的销售收入 请教高手! 如何得倒一个非常大的文件的最后几个特定字符的倒数的位置。在线等待。急
DataRow targetRow=dataTable.Rows[listBox1.SelectedIndex];
DataAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey; Application.DoEvents();
targetRow.BeginEdit();
targetRow["title"]=textBox1.Text;
targetRow.EndEdit();
DataSet DataSetChange=dataSet.GetChanges(DataRowState.Modified);
dataSet.Merge(DataSetChange);
DataAdapter.Update(dataSet,"code");
dataSet.AcceptChanges();
Application.DoEvents();这段代码执行之后运行该过程出现错误,但是数据库里的内容却更新了。怎么回事 阿?
错误提示:未处理的“System.Data.DBConcurrencyException”类型的异常出现在 system.data.dll 中其他信息:并发冲突:UpdateCommand 影响 0 个记录。
try
{
DataAdapter.Update(dataSet ,"code");
dataSet.AcceptChanges();
}
catch (DBConcurrencyException ex)
{
string customErrorMessage;
customErrorMessage = ex.Message;
customErrorMessage += ex.Row[0].ToString();
// Replace the above code with appropriate business logic
// to resolve the concurrency violation.
}