int no = FormView1.PageIndex;
查询:-
SqlCommand cmd = new SqlCommand("select Answer from Questions where QuestionNo = @no", cn);
最佳答案
你必须添加一个参数:
int no = FormView1.PageIndex;
SqlCommand cmd =
new SqlCommand("select Answer from Questions where QuestionNo = @no", cn);
// Set the parameter up before executing the command
cmd.Parameters.Add("@no", SqlDbType.Int);
cmd.Parameters["@no"].Value = no;
关于sql - 如何在sql查询中传递整型变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17553056/