コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            StudRegDAO studDAO = new StudRegDAO();

            List <StudentReg> studentList = new List <StudentReg>();

            studentList           = studDAO.getStudListInfo();
            GVStudList.DataSource = studentList;
            GVStudList.DataBind();
        }
コード例 #2
0
ファイル: regStudent.aspx.cs プロジェクト: 171107x/EADP
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Page.IsPostBack == false)
     {
         if (Session["SSTripID"] != null)
         {
             string        DBConnect = ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString;
             SqlConnection myConn    = new SqlConnection(DBConnect);
             string        TripID    = Session["SSTripID"].ToString();
             SqlCommand    cmd       = new SqlCommand("SELECT TripID FROM RegisteredStudent WHERE TripID ='" + TripID + "'", myConn);
             myConn.Open();
             SqlDataReader reader = cmd.ExecuteReader();
             try
             {
                 if (reader.HasRows)
                 {
                     tripDAO           tripDAO  = new tripDAO();
                     List <StudentReg> studList = new List <StudentReg>();
                     studList = tripDAO.getStudList(TripID);
                     GVStudList.DataSource = studList;
                     GVStudList.DataBind();
                 }
                 else
                 {
                     lblNoStud.Text = "No such record exist!";
                 }
                 myConn.Close();
             }
             catch (Exception ex)
             {
                 lblNoStud.Text = "idk what to put here";
             }
         }
         else
         {
             lblNoStud.Text = "No such record exist!!!";
         }
     }
 }