插入数据库数据
string txt_tdh_1 = Request.Form["txt_tdh"];string txt_djr_1 = Request.Form["txt_djr"];
string txt_djrq_1 = Request.Form["txt_djrq"];
string ddl_rjmc_1 = ddl_rjmc.DataValueField.ToString();
string ddl_wtmk_1 = ddl_wtmk.DataValueField.ToString();
string ddl_khmc_1 = ddl_khmc.DataValueField.ToString();
string txt_wtjs_1 = Request.Form["txt_wtjs"];
string txt_wtms_1 = Request.Form["txt_wtms"];
Insert_TempSql = "INSERT INTO TD_WT_DJB([WT_Tdbh],[WT_Tddjr],[WT_Tddjrq],[WT_Tdrjmc],[WT_Tdwtmk],[WT_Tdkhmc],[WT_Tdwtjs],[WT_Tdwlms]) VALUES(@WT_Tdbh,@WT_Tddjr,@WT_Tddjrq,@WT_Tdrjmc,@WT_Tdwtmk,@WT_Tdkhmc,@WT_Tdwtjs,@WT_Tdwlms)";
string connstring = System.Configuration.ConfigurationManager.AppSettings["TD_Conn"];
SqlConnection TD_conn = new SqlConnection(connstring);
TD_conn.Open();
SqlCommand TD_scd = new SqlCommand();
TD_scd.Connection = TD_conn;
TD_ = Insert_TempSql;
TD_scd.Parameters.Add("@WT_Tdbh", SqlDbType.Char,12).Value = txt_tdh_1;
TD_scd.Parameters.Add("@WT_Tddjr", SqlDbType.Char,20).Value = txt_djr_1;
TD_scd.Parameters.Add("@WT_Tddjrq", SqlDbType.DateTime).Value = txt_djrq_1;
TD_scd.Parameters.Add("@WT_Tdrjmc", SqlDbType.Char,20).Value = ddl_rjmc_1;
TD_scd.Parameters.Add("@WT_Tdwtmk", SqlDbType.Char,20).Value = ddl_wtmk_1;
TD_scd.Parameters.Add("@WT_Tdkhmc", SqlDbType.Char,20).Value = ddl_khmc_1;
TD_scd.Parameters.Add("@WT_Tdwtjs", SqlDbType.Char,50).Value = txt_wtjs_1;
TD_scd.Parameters.Add("@WT_Tdwlms", SqlDbType.VarChar,255).Value = txt_wtms_1;
TD_scd.ExecuteNonQuery();
TD_conn.Close();
执行到TD_scd.ExecuteNonQuery();老是提示:被准备语句 '(@WT_Tdbh char(12),@WT_Tddjr char(20),@WT_Tddjrq datetime,@WT_Td' 需要参数 @WT_Tdbh,但未提供该参数。