コード例 #1
0
        public List <StudentReg> getStudList(string TripID)
        {
            List <StudentReg> studList = new List <StudentReg>();
            DataSet           ds       = new DataSet();
            DataTable         tripData = new DataTable();

            StringBuilder sqlStr = new StringBuilder();

            sqlStr.AppendLine("SELECT * FROM RegisteredStudent");
            sqlStr.AppendLine("INNER JOIN Trip");
            sqlStr.AppendLine("ON RegisteredStudent.TripID = Trip.TripID");
            sqlStr.AppendLine("where RegisteredStudent.TripID = @paraTripID");

            SqlConnection  myConn = new SqlConnection(DBConnect);
            SqlDataAdapter da     = new SqlDataAdapter(sqlStr.ToString(), myConn);


            da.SelectCommand.Parameters.AddWithValue("@paraTripID", TripID);
            da.Fill(ds, "studList");

            int rec_cnt = ds.Tables["studList"].Rows.Count;

            if (rec_cnt > 0)
            {
                foreach (DataRow row in ds.Tables["studList"].Rows)
                {
                    StudentReg myStudList = new StudentReg();

                    myStudList.studentAdmin   = Convert.ToString(row["StudentAdmin"]);
                    myStudList.TripID         = row["TripID"].ToString();
                    myStudList.PassportNO     = row["PassportNO"].ToString();
                    myStudList.PassportExpiry = Convert.ToDateTime(row["PassportExpiry"]);

                    studList.Add(myStudList);
                }
            }
            else
            {
                studList = null;
            }

            return(studList);
        }
コード例 #2
0
        public List <StudentReg> getStudListInfo()
        {
            List <StudentReg> studentList = new List <StudentReg>();
            DataSet           ds          = new DataSet();
            DataTable         dt          = new DataTable();

            StringBuilder sqlStr = new StringBuilder();

            sqlStr.AppendLine("SELECT RegisteredStudent.StudentAdmin, Trip.TripID, RegisteredStudent.PassportNO, RegisteredStudent.PassportExpiry FROM RegisteredStudent");
            //sqlStr.AppendLine("SELECT * FROM RegisteredStudent");
            sqlStr.AppendLine("INNER JOIN Trip");
            sqlStr.AppendLine("ON RegisteredStudent.TripID = Trip.TripID");
            sqlStr.AppendLine("WHERE RegisteredStudent.TripID = 'Korea2018'");

            SqlConnection  myConn = new SqlConnection(DBConnect);
            SqlDataAdapter da     = new SqlDataAdapter(sqlStr.ToString(), myConn);

            da.Fill(ds, "studList");

            int rec_cnt = ds.Tables["studList"].Rows.Count;

            if (rec_cnt > 0)
            {
                foreach (DataRow row in ds.Tables["studList"].Rows)
                {
                    StudentReg myStudList = new StudentReg();

                    myStudList.TripID         = Convert.ToString(row["TripID"]);
                    myStudList.studentAdmin   = row["StudentAdmin"].ToString();
                    myStudList.PassportNO     = Convert.ToString(row["PassportNO"]);
                    myStudList.PassportExpiry = Convert.ToDateTime(row["PassportExpiry"]);

                    studentList.Add(myStudList);
                }
            }
            else
            {
                studentList = null;
            }

            return(studentList);
        }
コード例 #3
0
        public StudentReg getTripID(String studentAdmin)
        {
            DataSet   ds     = new DataSet();
            DataTable tdData = new DataTable();

            StringBuilder sqlStr = new StringBuilder();

            sqlStr.AppendLine("select * from RegisteredStudent");
            sqlStr.AppendLine("Where StudentAdmin = @paraStudAdmin and TripStatus = 'Accepted';");



            SqlConnection  myConn = new SqlConnection(DBConnect);
            SqlDataAdapter da     = new SqlDataAdapter(sqlStr.ToString(), myConn);



            da.SelectCommand.Parameters.AddWithValue("paraStudAdmin", studentAdmin);


            da.Fill(ds, "TableTD");



            int rec_cnt = ds.Tables["TableTD"].Rows.Count;

            StudentReg myTD = new StudentReg();

            if (rec_cnt > 0)
            {
                DataRow row = ds.Tables["TableTD"].Rows[0];
                myTD.studentAdmin = row["StudentAdmin"].ToString();
                myTD.TripID       = row["TripID"].ToString();
            }
            else
            {
                myTD = null;
            }

            return(myTD);
        }