2
我目前正在做一個前端顯示我公司的軟件審計許可證信息,但即時通訊沒有專業人士與SQL或asp.net所以四跑進了一點麻煩。我試圖獲得多行許可的總和,因此我可以把它放在一個文本框中,但是我得到錯誤「必須聲明標量變量」@softwareID「。c#asp.net問題'必須聲明標量變量'
SqlConnection con1 = Connect.GetSQLConnection();
string dataEntry = softwareInputTxt.Text;
string result;
dataEntry = dataEntry + "%";
con1.Open();
SqlCommand Mycmd1;
Mycmd1 = new SqlCommand("select sum(license_quantity_owned) from licenses where software_ID like @softwareID", con1);
MyCmd.Parameters.AddWithValue("@softwareID", dataEntry);
result = (string)Mycmd1.ExecuteScalar();
licenseOwnedTxt.Text = result;
任何人都可以指向正確的方向嗎?
哎呀,什麼是一個明顯的錯誤,但沒有人包括我發現它哈哈,theres其他命令我沒有打擾複製粘貼在這裏......現在工作正常謝謝 – Verian 2010-03-22 08:51:46