mahmud_uk

mahmud_uk

  • NA
  • 48
  • 0

Referencing Event

Aug 19 2004 5:46 AM
Hi Guys 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;" + "Network Library=DBMSSOCN;"+ "user id =xx;"+ "Password=xxxx"); da.Open(); SqlCommand thisCommand = da.CreateCommand(); tabPage3.Show(); 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()){ tabPage3.Show(); label3.Text = dr[ "Name" ].ToString();} da.Close(); } What do i need to do inorder to solve this scenario. Thanks,

Answers (5)