0
我试图更新表,但我不断收到异常:更新找不到TableMapping ...使用adapter.Update
我甚至尝试尽量减少我的代码,但我仍然没有看到问题
Items.cs
public static void WriteDescription()
{
DataSet items = DAL.GetDataSet("SELECT * FROM Items");
for (int i = 0; i < items.Tables[0].Rows.Count; i++)
items.Tables[0].Rows[i]["Description"] = "Hello";
DAL.UpdateDB("SELECT * FROM Items", items, "Items");
}
Dal.cs
static public void UpdateDB(string strSql, DataSet ds, string tablename)
{
SqlConnection connection = new SqlConnection(ConnectionString);
SqlCommand cmd = new SqlCommand(strSql, connection);
SqlDataAdapter adapter = new SqlDataAdapter(cmd);
new SqlCommandBuilder(adapter);
adapter.Update(ds, tablename);
}
而且我甚至试图消除的,有什么合作这是问题吗?