小菜问题3 需要参数 @isbn1,但未提供该参数
肥胖的柠檬 2007-07-27 01:30:46 SqlConnection con = new SqlConnection(link.connectionString);
SqlCommand cmd1= new SqlCommand();
cmd1.Connection = con;
//// Create the DeleteCommand.
cmd1.CommandText = " delete BookInfo where isbn=@isbn1";
cmd1.Parameters.Add("@isbn1", SqlDbType.VarChar, 20, "@isbn1");
cmd1.Parameters[0].Value = "";
da.DeleteCommand = cmd1;
if (cm.Count > 0)
{
string isBN = dataGridView1[0, cm.Position].Value.ToString().Trim();
cm.RemoveAt(cm.Position);
da.DeleteCommand.Parameters["@isbn1"].Value = isBN;
da.Update(ds.Tables["Table1"]);
}
--------------------------------------
参数化查询 '(@isbn1 varchar(20)) delete BookInfo where isbn=@isbn1' 需要参数 @isbn1,但未提供该参数。