public int updateJobWiseCGPA(CGPA cgpa) { try { using (SqlConnection con = new SqlConnection(ConnnectionString)) { SqlCommand cmd = new SqlCommand("updateJobWiseCGPA", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@CGPAId", cgpa.Id); cmd.Parameters.AddWithValue("@JobName", cgpa.JobName); cmd.Parameters.AddWithValue("@Semester", cgpa.Semester); cmd.Parameters.AddWithValue("@CGPA", cgpa.CGPAS); con.Open(); cmd.ExecuteNonQuery(); con.Close(); } return(1); } catch { throw; } }
public CGPA suggestCGPA(string JobName) { try { CGPA cgpa = new CGPA(); using (SqlConnection con = new SqlConnection(ConnnectionString)) { string sqlQuery = "SELECT * FROM CGPA WHERE JobName = " + JobName; SqlCommand cmd = new SqlCommand(sqlQuery, con); con.Open(); SqlDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { cgpa.JobName = rdr["JobName"].ToString(); cgpa.Semester = rdr["Semester"].ToString(); cgpa.CGPAS = Convert.ToInt32(rdr["CGPA"]); } } return(cgpa); } catch { throw; } }