从标题你可能知道我从sql数据库查询时无法得到结果。这是我的代码:
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();
}
然后我得到这个例外: -
System.Data.SqlClient.SqlException:必须声明标量变量“@Input1”。