Hi Experts,
I have two Forms, Form1 and Form2. In Form1 i have two textBoxes which i made public. From form2 iam trying to use the attributes of text from the texboxes to authenticate users through remote database and by a click of a button open another tabpage on from2. All the tabpages are on form2, by click of a button from tabpage1 tabpage3 should open. Here's the code, can some direct me what i should do to sort this out:
private void button1_Click(object sender, System.EventArgs e)
{
da.Open();
SqlCommand thisCommand = da.CreateCommand();
String sQuery = "SELECT Name, LicenseID FROM License WHERE Name = '"+ Form1.textBox1.Text +"' AND LicenseID = '"+ Form1.textBox2.Text +"'";
SqlCommand cmd = new SqlCommand(sQuery, da);
SqlDataReader dr = cmd.ExecuteReader();
if(dr.Read())
{
da.Close();
this.Visible = false;
tabPage3.ShowDialog();
this.Close();
}
}
I have two Forms, Form1 and Form2. In Form1 i have two textBoxes which i made public. From form2 iam trying to use the attributes of text from the texboxes to authenticate users through remote database and by a click of a button open another tabpage on from2. All the tabpages are on form2, by click of a button from tabpage1 tabpage3 should open. Here's the code, can some direct me what i should do to sort this out:
private void button1_Click(object sender, System.EventArgs e)
{
da.Open();
SqlCommand thisCommand = da.CreateCommand();
String sQuery = "SELECT Name, LicenseID FROM License WHERE Name = '"+ Form1.textBox1.Text +"' AND LicenseID = '"+ Form1.textBox2.Text +"'";
SqlCommand cmd = new SqlCommand(sQuery, da);
SqlDataReader dr = cmd.ExecuteReader();
if(dr.Read())
{
da.Close();
this.Visible = false;
tabPage3.ShowDialog();
this.Close();
}
}