[問題] 呼叫副程式的錯誤
各位版大前輩大家好
我寫了一隻web副程式
是要動態控制下拉式選單的資料來源
副程式的部分
public void BindDropDownListData(string L1,string L2,string L3)
{
資料庫連結部分省略
conn.Open();
SqlCommand cmd = new SqlCommand("select pro_name,type_id From
Reg_Pro_Item where type_id=@typeid", conn);
cmd.Parameters.Add("typeid", SqlDbType.Char, 2).Value = L1;
SqlDataAdapter mySqlDataAdapter03 = new SqlDataAdapter(cmd);
DataSet myDataSet03 = new DataSet();
mySqlDataAdapter03.Fill(myDataSet03);
DDLpro1.DataSource = myDataSet03;
DDLpro1.DataTextField = "pro_name";
DDLpro1.DataValueField = "type_id";
DDLpro1.DataBind();
SqlCommand cmdT = new SqlCommand("select pro_name,type_id From Reg_Pro_Item
where type_id=@typeid", conn);
cmd.Parameters.Add("typeid", SqlDbType.Char, 2).Value = L2;
SqlDataAdapter mySqlDataAdapter = new SqlDataAdapter(cmdT);
DataSet myDataSet = new DataSet();
mySqlDataAdapter.Fill(myDataSet); ←此段出現問題
DDLpro1.DataSource = myDataSet;
DDLpro1.DataTextField = "pro_name";
DDLpro1.DataValueField = "type_id";
DDLpro1.DataBind();
在第二個cmd的時候倒數第五行都會出現[必須宣告純量變數 "@typeid"]
試了好久都找不到問題,於是來此借助前輩們的幫忙
感激不盡
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 60.249.132.65
※ 編輯: te426odin 來自: 60.249.132.65 (02/06 19:47)
→
02/06 19:49, , 1F
02/06 19:49, 1F
→
02/06 19:55, , 2F
02/06 19:55, 2F
→
02/06 19:55, , 3F
02/06 19:55, 3F
→
02/06 19:56, , 4F
02/06 19:56, 4F
→
02/06 19:57, , 5F
02/06 19:57, 5F
※ 編輯: te426odin 來自: 60.249.132.65 (02/06 20:06)
→
02/08 09:13, , 6F
02/08 09:13, 6F
→
02/08 16:03, , 7F
02/08 16:03, 7F
C_Sharp 近期熱門文章
PTT數位生活區 即時熱門文章