C# access数据库 ExecuteNonQuery() 至少一个参数没有被指定值,求指导!!(附图,附代码)
代码:stringcnstr=@"Provider=Microsoft.Jet.OLEDB.4.0;DataSource=D:\Storeinfo.mdb";OleDbC...
代码:
string cnstr = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Storeinfo.mdb";
OleDbConnection oleConnection1 = new OleDbConnection(cnstr);
oleConnection1.Open();
OleDbCommand cmd = new OleDbCommand("", oleConnection1);
string sql = "update [materialinfo] set MName='" + textName.Text.Trim() + "',MModel='" + textModel.Text.Trim() + "'," + "MType='" + textType.Text.Trim() + "',MUnit='" + textUnit.Text.Trim() + "' where [MID]='" + textID.Text.Trim() + "'";
cmd.CommandText = sql;
cmd.ExecuteNonQuery();
MessageBox.Show("修改信息成功!", "提示");
oleConnection1.Close(); 展开
string cnstr = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Storeinfo.mdb";
OleDbConnection oleConnection1 = new OleDbConnection(cnstr);
oleConnection1.Open();
OleDbCommand cmd = new OleDbCommand("", oleConnection1);
string sql = "update [materialinfo] set MName='" + textName.Text.Trim() + "',MModel='" + textModel.Text.Trim() + "'," + "MType='" + textType.Text.Trim() + "',MUnit='" + textUnit.Text.Trim() + "' where [MID]='" + textID.Text.Trim() + "'";
cmd.CommandText = sql;
cmd.ExecuteNonQuery();
MessageBox.Show("修改信息成功!", "提示");
oleConnection1.Close(); 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询