private void ButtSave_Click(object sender, EventArgs e) { try { System.Data.SqlClient.SqlConnection sqlConnection1 =new System.Data.SqlClient.SqlConnection(@"server=DESKTOP-ULM6IGM\SQLEXPRESS;DataBase=Attendance;Integrated security=true;"); System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = "INSERT Admin(Emp_ID , Finger_ID) Values (@Emp_ID , @Finger_ID)"; cmd.Connection = sqlConnection1; sqlConnection1.Open(); cmd.ExecuteNonQuery(); sqlConnection1.Close(); MessageBox.Show("?? ????? ?????", "Update", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch { MessageBox.Show("????? ???? ?????", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } -------------------------------------------------------------------------------------------------------------------------------------------------------- private void ButtSave_Click(object sender, EventArgs e) { SqlConnection cn = new SqlConnection(@"server=DESKTOP-ULM6IGM\SQLEXPRESS;DataBase=Attendance;Integrated security=true;"); SqlDataAdapter da = new SqlDataAdapter(); da.InsertCommand = new SqlCommand("INSERT INTO Admin VALUES(@Emp_ID , @Finger_ID , @Username , @Password , @Competence , @User_type", cn); da.InsertCommand.Parameters.Add("@Emp_ID", SqlDbType.VarChar).Value = TxtEmpID.Text; da.InsertCommand.Parameters.Add("@Finger_ID", SqlDbType.VarChar).Value = TxtFingerID.Text; da.InsertCommand.Parameters.Add("@Username", SqlDbType.VarChar).Value = TxtUsername.Text; da.InsertCommand.Parameters.Add("@Password", SqlDbType.VarChar).Value = TxtPass.Text; da.InsertCommand.Parameters.Add("@Competence", SqlDbType.VarChar).Value = ComboCom.SelectedIndex.ToString(); da.InsertCommand.Parameters.Add("@User_type", SqlDbType.VarChar).Value = ComboUsertype.SelectedIndex.ToString(); cn.Open(); da.InsertCommand.ExecuteNonQuery(); MessageBox.Show("?? ????? ?????", "Update", MessageBoxButtons.OK, MessageBoxIcon.Information); cn.Close(); }