62,046
社区成员
发帖
与我相关
我的任务
分享
select count(*) from login where username='"+this.TextBox1.Text+"'"与
select * from login where username='"+this.TextBox1.Text+"'"
的 区别, 我在写登录的时候用到的,
SqlConnection conn = new SqlConnection("server=.;database=db_login;uid=sa;pwd=123;");
conn.Open();
SqlCommand cmd = new SqlCommand("select count(*) from login where username='"+this.TextBox1.Text+"'", conn);
int count =Convert.ToInt32( cmd.ExecuteScalar());
if (count > 0)
{
Response.Redirect("index.aspx");
}