public void insert(string staffID, ScoreDTO value) { string cmd = "SP_INS_DIEM"; SqlCmd = new SqlCommand(cmd, SqlCon); SqlCmd.CommandType = CommandType.StoredProcedure; SqlParameter StaffID = new SqlParameter("@MANV", SqlDbType.VarChar, 20, "MANV"); StaffID.IsNullable = false; StaffID.Direction = ParameterDirection.Input; StaffID.Value = staffID; SqlCmd.Parameters.Add(StaffID); SqlParameter StudentID = new SqlParameter("@MASV", SqlDbType.VarChar, 20, "MASV"); StudentID.IsNullable = false; StudentID.Direction = ParameterDirection.Input; StudentID.Value = value.StudentID; SqlCmd.Parameters.Add(StudentID); SqlParameter CourseID = new SqlParameter("@MAHP", SqlDbType.VarChar, 20, "MAHP"); CourseID.IsNullable = false; CourseID.Direction = ParameterDirection.Input; CourseID.Value = value.CourseID; SqlCmd.Parameters.Add(CourseID); SqlParameter Score = new SqlParameter("@DIEMTHI", SqlDbType.VarChar, 20, "DIEMTHI"); Score.IsNullable = false; Score.Direction = ParameterDirection.Input; Score.Value = value.Score; SqlCmd.Parameters.Add(Score); this.executeNonQuery(); }
public void addScore(string staffID, ScoreDTO value) { scoredao.insert(staffID, value); }
private void button_Commit3_Click(object sender, EventArgs e) { try { ScoreDTO scoredto = new ScoreDTO(); scoredto.StudentID = textBox_Student3.Text; scoredto.CourseID = textBox_CourseID3.Text; scoredto.Score = string.Format("{0}", float.Parse(textBox_Score3.Text)); scorebll.addScore(_staffdto.StaffID, scoredto); textBox_Student3.Text = ""; textBox_CourseID3.Text = ""; textBox_Score3.Text = ""; } catch (System.Exception ex) { MessageBox.Show(ex.Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }