DataTable中NewRow的问题
ylhyh 2006-12-01 05:34:59 SQL Server中的表结构:
Col1 int
Col2 int
Col3 int
ColTotal as Col1+Col2+Col3 计算列
用DataAdapter把该中的数据Fill到了一个DataTable dtTmp中
DataRow drTmp=dtTmp.NewRow();
dtTmp["Col1"]=1;
dtTmp["Col2"]=2;
dtTmp["Col3"]=3;
dtTmp.Rows.Add(dtTmp);
MyDataAdapter.Update(dtTmp);
用DataAdapter进行Update的时候提示错误:ColTotal列是计算列,不能Modify
我并没有对ColTotal列进行赋值,NewRow方法不是根据表的规则创建一个DataRow吗?为什么会对ColTotal列产生Modify??