public static List <ProgramList> GetProgramName(string SearchProgramTxt, string StudentId) { List <ProgramList> empResult = new List <ProgramList>(); { DBCommon db = new DBCommon(); using (SqlCommand cmd = new SqlCommand()) { cmd.CommandText = "sp_GetEduProgramListAutocom"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@SearchProgramTxt", SearchProgramTxt); cmd.Parameters.AddWithValue("@StudentId", Convert.ToInt32(StudentId)); DataTable dt = db.GetTable(cmd); foreach (DataRow dr in dt.Rows) { ProgramList pr = new ProgramList(); pr.ProgramId = dr["ProgramId"].ToString(); pr.ProgramName = dr["ProgramName"].ToString(); empResult.Add(pr); } return(empResult); } } }
public void GetProgramList() { int studentId = 0; DBCommon db = new DBCommon(); using (SqlCommand cmd = new SqlCommand()) { studentId = Convert.ToInt32(Session["StudentId"]); //cmd.CommandText = "SELECT ProgramId, ProgramName from tsProgram order by ProgramName Asc"; cmd.CommandText = "sp_GetEduProgramListBrowse"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@StudentID", studentId); DataTable dt = db.GetTable(cmd); ProgramList.DataSource = dt; ProgramList.DataBind(); } }