到底哪个值没赋值啊,求求各位高手帮我解决一下:
//实体类实例化
Items item = new Items();
item.excID = get_excID() + 1;
item.excTypeID = this.lBType_main.SelectedValue.ToString();
item.excTypeSonID = this.lBType_son.SelectedValue.ToString();
item.excItemTitle = this.txtGoodName.Text;
item.excItemDescription = this.txtGoodDesription.Text;
item.excNewOld = this.ddlNewLevel.SelectedValue.ToString();
item.excGoodNum =this.txtGoodNum.Text;
item.excItemAddMan = excAddMan;
//插入语句
OleDbConnection conn = DBConn.createConn();
conn.Open();
OleDbCommand cmd = new OleDbCommand("insert into exchanges values(@excID,@excTypeID,@excTypeSonID,@excItemTitle,@excItemAddMan,@excItemDescription,@excGoodNum,@excNewOld)", conn);
OleDbParameter para = new OleDbParameter("@excID", OleDbType.Numeric);
para.Value = item.excID;
cmd.Parameters.Add(para);
para = new OleDbParameter("@excTypeID", OleDbType.Numeric);
para.Value = item.excTypeID;
cmd.Parameters.Add(para);
para = new OleDbParameter("@excTypeSonID", OleDbType.Numeric);
para.Value = item.excTypeSonID;
cmd.Parameters.Add(para);
para = new OleDbParameter("@excItemTitle", OleDbType.VarChar, 50);
para.Value = item.excItemTitle;
cmd.Parameters.Add(para);
para = new OleDbParameter("@excItemAddMan", OleDbType.VarChar, 50);
para.Value = item.excItemAddMan;
cmd.Parameters.Add(para);
para = new OleDbParameter("@excItemDescription", OleDbType.VarChar, 100);
para.Value = item.excItemDescription;
cmd.Parameters.Add(para);
para = new OleDbParameter("@excGoodNum", OleDbType.Numeric);
para.Value = item.excGoodNum;
cmd.Parameters.Add(para);
para = new OleDbParameter("@excNewOld", OleDbType.VarChar, 50);
para.Value = item.excNewOld;
cmd.ExecuteNonQuery();
參考答案:在使用存储过程的时候,参数没有给指定值,或是值不合法