private void button1_Click(object sender, EventArgs e) { if (txtRollNo.Text == "") { MessageBox.Show("Enter RollNumber ", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Hand); } else { try { con = new SqlConnection(c); con.Open(); cmd = new SqlCommand("INSERT into Attendece (RollNo,Date)VALUES('" + txtRollNo.Text + "','" + dateTimePicker1.Text + "')", con); cmd.ExecuteNonQuery(); cmd.Parameters.Clear(); MessageBox.Show("Attendence Uploaded", "S A V E", MessageBoxButtons.OK, MessageBoxIcon.Information); dataGridView1.DataSource = ds.Tables["tbl"].DefaultView;//////////// //cmd.parameters.clear(); con.Close(); this.Hide(); frmAttendence a = new frmAttendence(); a.Show(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void btnAttendence_Click(object sender, EventArgs e) { frmAttendence attendence = new frmAttendence(); attendence.Show(); }