it can be declare globaly
SqlConnection con;
SqlCommand cmd;
SqlDataReader dr;
int flag = 0;
string s1, s2, uname, upass;
write code on btton click event it shoud be great helpful
con = new SqlConnection("Data Source=.; Initial Catalog=krishna; Integrated Security =true;");
con.Open();
cmd = new SqlCommand("select *from register", con);
dr = cmd.ExecuteReader();
while (dr.Read())
{
uname = dr[2].ToString();
upass = dr[3].ToString();
if (s1 == uname && s2 == upass)
{
flag = 1;
break;
}
}
if (flag == 1)
{
Server.Transfer("Welcometest.aspx?uname=+"+s1+"");
}
else
{
Label3.Visible = true;
}
in this code equire database file to match the database and go to the next page