至少一个参数没有被指定
我老出现新的问题这个又提示:至少一个参数没有被指定! 哪位高手能给我个样板啊
只要点击一个按钮 ,然后让一个文本中的内容插入到数据库中
小弟跪求,再此感激涕零……
String s1= comboBoxIncome.Text.ToString();
String s2 = textBoxItem.Text.ToString();
String s4 = textBoxSum.Text.ToString();
String s3= richTextBoxRemark.Text.ToString();
try
{
if (s1 != "请选择类别" && s2 != "" && s3 != "" && s4 != "¥0")
{
String strconn = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=Data.mdb" ;
OleDbConnection oleconn = new OleDbConnection(strconn);
oleconn.Open();
String strInsert = "INSERT INTO InOut(收支,类别,项目,备注,金额(¥),日期)VALUES('收',s1,s2,s3,s4,System.DateTime.Now)";
OleDbCommand olecom = new OleDbCommand(strInsert,oleconn);
olecom.ExecuteNonQuary();
oleconn.Close();
DataSet ds = new DataSet();
BindingManagerBase myBind;
myBind=this.BindingContext[ds,"InOut"];
ds.Tables["InOut"].Rows[myBind.Position].BeginEdit();
ds.Tables["InOut"].Rows[myBind.Position].EndEdit();
ds.Tables["InOut"].AcceptChanges();
MessageBox.Show(s1 + "\n" + s2 + "\n" + s3 + "\n" + s4 + "\n" + "已加入数据库", "提示!");
}
else
MessageBox.Show("必须填满所有字段值!", "错误!");
}catch(Exception me)
{
MessageBox.Show("保存数据记录发生"+me.ToString(),"错误!");
}