private void button3_Click(object sender, EventArgs e) { frmStudentsDetails s1 = new frmStudentsDetails(); s1.Show(); this.Hide(); }
public void AddAttendence() { String conURL1 = "Data Source = DESKTOP-RPO4Q5R\\PARVEEN; Initial Catalog = ProjectB ; User ID = mohsin; Password = mohsin123; MultipleActiveResultSets = True"; SqlConnection conn1 = new SqlConnection(conURL1); conn1.Open(); String cmd1 = "insert into ClassAttendance values ('" + Convert.ToDateTime(dtpDate.Text) + "')"; SqlCommand cmd = new SqlCommand(cmd1, conn1); int i = cmd.ExecuteNonQuery(); conn1.Close(); if (i != 0) { MessageBox.Show(i + "Record Has Been Saved"); } frmStudentsDetails s1 = new frmStudentsDetails(); }