在内存中操作DataTable后如何更新到数据库 本帖最后由 xu345713970 于 2012-07-31 20:40:33 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 public int UpdateByDataSet(DataSet ds,string strTblName,string strConnection){ try { SqlConnection conn = new SqlConnection(strConnection)); SqlDataAdapter myAdapter = new SqlDataAdapter(); SqlCommand myCommand = new SqlCommand("select * from "+strTblName),(SqlConnection)this.conn); myAdapter.SelectCommand = myCommand; SqlCommandBuilder myCommandBuilder = new SqlCommandBuilder(myAdapter); myAdapter.Update(ds,strTblName); return 0; } catch(BusinessException errBU) { throw errBU; } catch(Exception err) { throw new BusinessException(err); }} http://topic.csdn.net/u/20120609/16/57729ce3-fe64-425f-bd3d-1a84695e9ba3.html dotnetbar的calendarView如何使用? c#中<(小于号)不能在页面显示 关于接口和继承的奇怪问题 textBox检验是否是数字? 能不能锁定注册表? C# vs VB.NET 如何保持100个线程在工作 C#事务的问题,SqlTransaction 的对象,可以夸方法传递吗 征集 .NET WebLog 或 .NET Blogger 主子窗体的问题? 如果判断多行字符串共同含有什么子字符串(该子字符串须长度最长的) 怎么从字符串中。读到类似@。&。*的特殊符号。替换成汉字
{
try
{
SqlConnection conn = new SqlConnection(strConnection));
SqlDataAdapter myAdapter = new SqlDataAdapter();
SqlCommand myCommand = new SqlCommand("select * from "+strTblName),(SqlConnection)this.conn);
myAdapter.SelectCommand = myCommand;
SqlCommandBuilder myCommandBuilder = new SqlCommandBuilder(myAdapter);
myAdapter.Update(ds,strTblName);
return 0;
}
catch(BusinessException errBU)
{
throw errBU;
}
catch(Exception err)
{
throw new BusinessException(err);
}
}