From the title you may know that I cannot get the result when I query from sql database. Here is my code :
public string Summon(int Input1)
{
SqlDataAdapter dbadapter = null;
DataSet returnDS = new DataSet();
using (SqlConnection dbconn = new SqlConnection(
"DatabaseConnection"))
{
SqlCommand cmd = new SqlCommand();
//string sqlQuery = "select * from SUMMON";
string sqlQuery = "select * from SUMMON where ic_no=@Input1";
cmd.CommandText = sqlQuery;
cmd.Connection = dbconn;
dbadapter = new SqlDataAdapter(cmd);
dbadapter.Fill(returnDS);
}
return returnDS.GetXml();
}
然后,我获得这一例外:
系统.Data.SqlClient.SqlException: 须申报数字变量“@Input1”。