运行到da.Fill(data,"销售");就出现问题:参数化查询 '(@编号 char(20),@型号规格 char(20),@销售单价
protected void Button2_Click(object sender, EventArgs e){
SqlDataAdapter da = new SqlDataAdapter();
SqlConnection conn = new SqlConnection();
conn.ConnectionString = "Data Source=RGYJ-AVTYN682XD;Initial Catalog=库;User ID=sa;Password=sa123456789";
SqlCommand selectCmd = new SqlCommand();
= "SELECT * FROM 库存";
selectCmd.Connection = conn;
SqlCommand insertCmd = new SqlCommand();
= "insert into 销售 values(@编号,@型号规格,@销售单价,@数量,@总价,@利润)";
insertCmd.Connection = conn;
insertCmd.Parameters.Add("@编号", SqlDbType.Char, 20, "编号");
insertCmd.Parameters.Add("@型号规格", SqlDbType.Char, 20, "型号规格");
insertCmd.Parameters.Add("@销售单价", SqlDbType.Float,10, "销售单价");
insertCmd.Parameters.Add("@数量", SqlDbType.Int, 20, "数量");
insertCmd.Parameters.Add("@总价", SqlDbType.Float,10, "总价");
insertCmd.Parameters.Add("@利润", SqlDbType.Float, 10, "利润");
da.SelectCommand = selectCmd;
da.SelectCommand = insertCmd;
DataSet data = new DataSet();
da.Fill(data, "销售");
DataRow drNew = data.Tables["销售"].NewRow();
drNew[1] = TextBox4.Text;
drNew[2] = TextBox5.Text;
drNew[3] = TextBox6.Text;
drNew[4] = TextBox7.Text;
data.Tables["销售"].Rows.Add(drNew);
da.Update(data, "销售");
}
运行到da.Fill(data,"销售");就出现问题:参数化查询 '(@编号 char(20),@型号规格 char(20),@销售单价 float,@数量 int,@总价 float,@利润 f' 需要参数 @编号,但未提供该参数。求解答