private void button2_Click(object sender, EventArgs e) { try { if (SID.Text == "" || Fnametxt.Text == "" || Lnametxt.Text == "" || emailtxt.Text == "" || contacttxt.Text == "") { MessageBox.Show("Please fill the all fields"); } else { SqlConnection conn = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=D:\Register.mdf;Integrated Security=True;Connect Timeout=30"); conn.Open(); String insert = "insert into LG (ID,Fname,Lname,email,contact,password) values ('" + SID.Text + "','" + Fnametxt.Text + "','" + Lnametxt.Text + "','" + emailtxt.Text + "','" + contacttxt.Text + "')"; SqlCommand cmd = new SqlCommand(insert, conn); cmd.ExecuteNonQuery(); this.Hide(); las home = new las(); home.Show(); MessageBox.Show("Registration succesfull!!"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/* private void iconButtonReport_Click(object sender, EventArgs e) * { * * OpenChildForm(new SReport()); * } */ private void iconCurrentChildForm_Click(object sender, EventArgs e) { this.Hide(); las registraton = new las(); registraton.Show(); }
private void Home_Click(object sender, EventArgs e) { this.Hide(); las nw = new las(); nw.Show(); }
private void button1_Click(object sender, EventArgs e) { try { SqlConnection conn = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=D:\Register.mdf;Integrated Security=True;Connect Timeout=30"); SqlDataAdapter sda = new SqlDataAdapter("select count(*) from Admintb where username = '******' and password = '******'", conn); DataTable dt = new DataTable(); sda.Fill(dt); if (dt.Rows[0][0].ToString() == "1") { this.Hide(); las mm = new las(); mm.Show(); } else { MessageBox.Show("Invalid Login Creditionals !!", "alert", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }