Posted on 2004-08-18
I have two Forms. In form1 there are two textBoxes, i'm trying to refrence these two textBoxes in Form2. I'm having problem refrencing them. I need to call these two textBoxes inorder to authenticate users. Both these textBoxes have been made public.
Also i have tabPages in form2,from tabPage2, by a click of a button i'm trying to pen tabPage3, but having problem with this too. This is mainly due to authentication problem. Heres the code:
private void button1_Click(object sender, System.EventArgs e)
SqlConnection da = new SqlConnection(
@"Data Source= xxxxxx;"+
"Initial Catalog = xxxx;" +
"user id =xx;"+
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();
label3.Text = dr[ "Name" ].ToString();}
What do i need to do inorder to solve this scenario.