文本与数据库内容比较
string username = TxtName.Text.Trim();string userpwd = TxtPsw.Text.Trim();
SqlConnection conn=new SqlConnection();
conn.ConnectionString=(@"Data Source=RGYJ-AVTYN682XD;Initial Catalog=库;User ID=sa;Password=sa123456789");
conn.Open();
string cmdStr = "select * from 用户信息 where 用户名='" + username + "' and 密码='" + userpwd + "'";
SqlCommand cmd = new SqlCommand(cmdStr,conn);
SqlDataReader myReader = cmd.ExecuteReader();
if (myReader.Read())
{
BtnSure.PostBackUrl = "~/Welcome.aspx";
}
else
Response.Redirect("Error.aspx");
conn.Close();
conn.Dispose();
这是核心代码,可是我要点击2次按钮才跳转 怎么实现一次点击就实现比较和跳转