0% found this document useful (0 votes)
18 views1 page

Tilak Coding

Uploaded by

Chaman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views1 page

Tilak Coding

Uploaded by

Chaman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

SqlConnection con = new SqlConnection("Data Source=.

\\SQLEXPRESS;Initial
Catalog=reception;Integrated Security=True;Pooling=False");

string reception = "SELECT Firstname, Lastname, password,


Email, Gender FROM reception WHERE (Email = @email) AND (password = @password)";
SqlCommand cmd = new SqlCommand(reception, con);
cmd.Parameters.AddWithValue("@email",txtemail.Text);
cmd.Parameters.AddWithValue("@password",txtpass.Text);
con.Open();
SqlDataReader dr = cmd.ExecuteReader();
if(dr.HasRows)
{
Class1.uname = txtemail.Text;
this.DialogResult=DialogResult.OK;
MessageBox.Show("Login successfully");

txtemail.Clear();
txtpass.Clear();

}
else
{
MessageBox.Show("Invalid UserId or Password.");
}
con.Close();

You might also like