日期:2014-05-18 浏览次数:20732 次
string strsql = "insert into subitem (id,subitem,item,dept) values(2,2,3,4)"; try { SqlDaConn.Open(); SqlDataAdapter SqlDa = new SqlDataAdapter(StrSql, SqlDaConn); SqlCommandBuilder SqlCb = new SqlCommandBuilder(SqlDa); return SqlDa; } catch { return null; }
string strsql = "insert into subitem (id,subitem,item,dept) values(2,2,3,4)"; SqlDaConn.Open(); SqlCommand SqlDa = new SqlCommand(StrSql, SqlDaConn); SqlDa.ExcuteNonQuery();
------解决方案--------------------
SqlDaConn.Open();
SqlCommandBuilder SqlCb = new SqlCommandBuilder(strsql,SqlDaConn);
SqlDataAdapter SqlDa = new SqlDataAdapter(SqlCb);
这样试试
------解决方案--------------------
都没有执行 ExcuteNonQuery ,怎么添加到数据库,这种问题,就不知道自己查查资料
------解决方案--------------------