public List <clsstudentadmissionprp> Get_StudentID() { try { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("GetMaxID", con); // cmd.CommandType = CommandType.StoredProcedure; SqlDataReader dr = cmd.ExecuteReader(); List <clsstudentadmissionprp> obj = new List <clsstudentadmissionprp>(); if (dr.HasRows) { dr.Read(); clsstudentadmissionprp k = new clsstudentadmissionprp(); k.P_id = Convert.ToInt32(dr[0]); obj.Add(k); } dr.Close(); cmd.Dispose(); con.Close(); return(obj); } catch (Exception ex) { throw ex; } }
public void updatestudent_rec(clsstudentadmissionprp p) { if (con.State == ConnectionState.Closed) { con.Open(); } try { SqlCommand cmd = new SqlCommand("updstudent", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = con; cmd.Parameters.Add("@id", SqlDbType.Int).Value = p.P_id; cmd.Parameters.Add("@course", SqlDbType.VarChar, 100).Value = p.P_course; cmd.Parameters.Add("@stuname", SqlDbType.VarChar, 100).Value = p.p_stuname; cmd.Parameters.Add("@fathername", SqlDbType.VarChar, 100).Value = p.P_fathername; cmd.Parameters.Add("@adress", SqlDbType.VarChar, 100).Value = p.P_address; cmd.Parameters.Add("@gender", SqlDbType.VarChar, 100).Value = p.P_gender; cmd.Parameters.Add("@phonno", SqlDbType.VarChar, 100).Value = p.P_mobileno; cmd.Parameters.Add("@parentphonno", SqlDbType.VarChar, 100).Value = p.P_parentmob; cmd.Parameters.Add("@dob", SqlDbType.VarChar, 100).Value = p.P_dob; cmd.Parameters.Add("@emailid", SqlDbType.VarChar, 100).Value = p.p_emailid; cmd.Parameters.Add("@fees", SqlDbType.Float).Value = p.P_fees; cmd.Parameters.Add("@instalment", SqlDbType.Float).Value = p.P_installment; cmd.Parameters.Add("@regdate", SqlDbType.VarChar, 100).Value = p.p_regdate; // cmd.Parameters.Add("@operator", SqlDbType.VarChar, 100).Value = user; cmd.Parameters.Add("@idproof", SqlDbType.VarChar, 100).Value = p.P_idproof; cmd.Parameters.Add("@operator", SqlDbType.VarChar, 100).Value = p.P_operator; cmd.ExecuteNonQuery(); cmd.Dispose(); } catch (Exception ex) { throw ex; } }
public List <clsstudentadmissionprp> Find_Rec(Int32 id) { if (con.State == ConnectionState.Closed) { con.Open(); } // try //{ SqlCommand cmd = new SqlCommand("findstudent", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@id", SqlDbType.Int).Value = id; SqlDataReader dr = cmd.ExecuteReader(); List <clsstudentadmissionprp> obj = new List <clsstudentadmissionprp>(); if (dr.HasRows) { dr.Read(); clsstudentadmissionprp k = new clsstudentadmissionprp(); k.P_id = Convert.ToInt32(dr[0]); k.p_stuname = dr[1].ToString(); k.P_fathername = dr[2].ToString(); k.P_course = dr[3].ToString(); k.P_dob = dr[4].ToString(); k.P_address = dr[5].ToString(); k.P_mobileno = dr[6].ToString(); k.P_parentmob = dr[7].ToString(); k.P_gender = dr[8].ToString(); k.p_emailid = dr[9].ToString(); k.P_fees = Convert.ToDouble(dr[10]); k.P_installment = Convert.ToDouble(dr[11]); k.p_regdate = dr[12].ToString(); k.P_operator = dr[13].ToString(); k.P_idproof = dr[14].ToString(); k.P_image = dr[15].ToString(); obj.Add(k); } dr.Close(); cmd.Dispose(); con.Close(); return(obj); // } //catch(Exception ex) //{ // throw ex; // //throw new Exception(ex.Message + " -- " + ex.InnerException); //} }
public List <clsstudentadmissionprp> Disp_Rec() { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand(); cmd.CommandText = "dispstudent"; cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = con; SqlDataReader dr = cmd.ExecuteReader(); List <clsstudentadmissionprp> obj = new List <clsstudentadmissionprp>(); while (dr.Read()) { clsstudentadmissionprp k = new clsstudentadmissionprp(); // k.P_id = Convert.ToInt32(dr[0]); k.p_stuname = dr[1].ToString(); k.P_fathername = dr[2].ToString(); k.P_course = dr[3].ToString(); k.P_dob = dr[4].ToString(); k.P_address = dr[5].ToString(); k.P_mobileno = dr[6].ToString(); k.P_parentmob = dr[7].ToString(); k.P_gender = dr[8].ToString(); k.p_emailid = dr[9].ToString(); k.P_fees = Convert.ToDouble(dr[10]); k.P_installment = Convert.ToDouble(dr[11]); k.p_regdate = dr[12].ToString(); k.P_operator = dr[13].ToString(); k.P_idproof = dr[14].ToString(); obj.Add(k); } dr.Close(); cmd.Dispose(); con.Close(); return(obj); }