请教:vs.net连接数据库编程时提示列名无效
请教:下面程序运行的时候提示错误说列名“username无效,userpwd无效”是怎么回事啊?string txtusername = Request.QueryString["username"].ToString();
string txtuserpwd = Request.QueryString["userpwd"].ToString();
SqlConnection con = new SqlConnection("server=.;database=login;uid=sa;pwd=a;");
con.Open();
SqlCommand cmd = new SqlCommand("select count(*) from login where username='" + txtusername + "'and userpwd='" + txtuserpwd + "'", con);
[bo]int count = Convert.ToInt32(cmd.ExecuteScalar());[/bo]
if (count > 0)
{
Response.Redirect("main.aspx");
}
else
{
Response.Redirect("loginfail.htm");
}
红色行为错误提示行