使用“ 0 = 1”过滤器设置选择命令,并使用SqlCommandBuilder,以便自动为您生成insert命令。
var sqlQuery = "select * from Customers where 0 = 1";dataAdapter = new SqlDataAdapter(sqlQuery, conn);dataSet = new DataSet();dataAdapter.Fill(dataSet);var newRow = dataSet.Tables["Customers"].NewRow();newRow["CustomerID"] = 55;dataSet.Tables["Customers"].Rows.Add(newRow);new SqlCommandBuilder(dataAdapter);dataAdapter.Update(dataSet);
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)