I have two forms, form1 and form2. I also have this login page written in C# in form1. I'm trying to authenticate users through SQL database, if authenticated they will login to form 2, if not an error message should pop up and not allow form2 to open. Also after authentication is sucessfull, form1 should close and form2 should stay open. First concentrate on authenticating users and allowwing form2 to open. Afterwards form1 should close automatically if users are authenticated.Here's the code:
SqlCommand thisCommand = da.CreateCommand();
String sQuery = "SELECT count(*) FROM License WHERE Name = '"+ textBox1.Text +"' AND LicenseID = '"+ textBox2.Text +"'"
SqlCommand cmd = new SqlCommand(sQuery, da);
SqlDataReader dr = cmd.ExecuteReader();
Form2 frm = new Form2();
//if (dr.["License"].Rows.Count == 0)
//MessageBox.Show("Incorrect UserName and/or ID, Try again!");
I'm stuck on authentication and closing the form1, can someone direct me where i have gone wrong.