Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening another tabPage

Status
Not open for further replies.

choudhmh

Programmer
Aug 9, 2004
34
GB
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();
}


}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top