string name=txtusername .Text.Trim ();
string pass = txtpassword.Text.Trim ();
String connectionString = "Server=.;database=sampledatabase;uid=sa;";
String cmdtext = "select * from logon where username='"+name+"' and password='"+pass+"'";
SqlConnection s1 = new SqlConnection(connectionString);
s1.Open();
SqlCommand command = new SqlCommand(cmdtext, s1);
int a = command.ExecuteNonQuery();
if (a > 0)
{
Response.Redirect("http://www.baidu.com");
}
else
{
Response.Redirect("http://www.hao123.com");
}
s1.Close();
不知道哪里有问题总是去hao123,求高手帮帮
string pass = txtpassword.Text.Trim ();
String connectionString = "Server=.;database=sampledatabase;uid=sa;";
String cmdtext = "select * from logon where username='"+name+"' and password='"+pass+"'";
SqlConnection s1 = new SqlConnection(connectionString);
s1.Open();
SqlCommand command = new SqlCommand(cmdtext, s1);
int a = command.ExecuteNonQuery();
if (a > 0)
{
Response.Redirect("http://www.baidu.com");
}
else
{
Response.Redirect("http://www.hao123.com");
}
s1.Close();
不知道哪里有问题总是去hao123,求高手帮帮