private void button2_Click(object sender, EventArgs e) { SetValueForText1 = ENROLLBOX.Text; SetValueForText2 = PASSBOX.Text; SqlConnection con = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\Omkar\Documents\Visual Studio 2010\Projects\studentprofiledesign1\studentprofiledesign1\Data.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"); COMMAND = new SqlCommand("Select * From REGISTRATION_TABLE1 Where ENROLLMENT_NO=@ENROLLMENT_NO and PASSWORD=@PASSWORD", con); COMMAND.Parameters.Add("@ENROLLMENT_NO", SqlDbType.VarChar).Value = ENROLLBOX.Text; COMMAND.Parameters.Add("@PASSWORD", SqlDbType.VarChar).Value = PASSBOX.Text; SqlDataAdapter sda = new SqlDataAdapter(COMMAND); DataTable dt = new DataTable(); sda.Fill(dt); if (dt.Rows.Count == 1) { this.Hide(); MYPROFILE ss = new MYPROFILE(); ss.Show(); } else { MessageBox.Show("PLEASE CHECK USERNAME OR PASSWORD!!!"); ENROLLBOX.Text = ""; PASSBOX.Text = ""; } }
private void button2_Click(object sender, EventArgs e) { SetValueForText1 = textBox11.Text; this.Hide(); MYPROFILE MP = new MYPROFILE(); MP.Show(); }