Beispiel #1
0
 private void buttonQUERY_Click(object sender, EventArgs e)
 {
     try
     {
         if (textEditID.Text != "")
         {
             string strSQL = "select * from StudentBasicInfo where ID=" + textEditID.Text;
             gridCtrl_StudentInfo.DataSource = db.ExecuteDataSet(strSQL, oleConn).Tables[0].DefaultView;
         }
         else if (textEditNAME.Text != "")
         {
             string strSQL = "select * from StudentBasicInfo where NAME='" + textEditNAME.Text + "'";
             gridCtrl_StudentInfo.DataSource = db.ExecuteDataSet(strSQL, oleConn).Tables[0].DefaultView;
         }
         else if (comboBoxEditTEAM.Text != "")
         {
             int    ntemp  = comboBoxEditTEAM.SelectedIndex + 1;
             string strSQL = "select * from StudentBasicInfo where TEAM=" + ntemp.ToString();
             gridCtrl_StudentInfo.DataSource = db.ExecuteDataSet(strSQL, oleConn).Tables[0].DefaultView;
         }
         else if (comboBoxEditCLASS.Text != "")
         {
             string strSQL = "select * from StudentBasicInfo where CLASS=" + comboBoxEditCLASS.Text;
             gridCtrl_StudentInfo.DataSource = db.ExecuteDataSet(strSQL, oleConn).Tables[0].DefaultView;
         }
     }
     catch
     { MessageBox.Show("查询有误"); }
 }
        /// <summary>
        /// 返回内连接数据表
        /// </summary>
        /// <returns></returns>
        public DataSet GetDataSet()
        {
            string strSQL = "SELECT StudentBasicInfo.ID,StudentBasicInfo.NAME,StudentBasicInfo.GRADE,StudentBasicInfo.TEAM,StudentBasicInfo.IsPartyMember,StudentPunishmentRecords.PUNISHMENT,StudentPunishmentRecords.EXEDATETIME, StudentPunishmentRecords.EXEUNIT,StudentPunishmentRecords.REASON ";

            strSQL += " FROM StudentBasicInfo INNER JOIN StudentPunishmentRecords ON StudentBasicInfo.ID = StudentPunishmentRecords.ID";
            return(db.ExecuteDataSet(strSQL, oleConn));
        }
Beispiel #3
0
        /// <summary>
        /// 获取学生请假表
        /// </summary>
        /// <returns></returns>
        public DataTable GetPersonLeavesTable()
        {
            string strSQL = "SELECT StudentBasicInfo.ID,StudentBasicInfo.TEAM,StudentBasicInfo.CLASS,StudentBasicInfo.NAME,StudentLeaveRecords.LEAVEDATE,StudentLeaveRecords.DUEDATE,StudentLeaveRecords.RETURNDATE FROM StudentBasicInfo INNER JOIN StudentLeaveRecords ON StudentBasicInfo.ID = StudentLeaveRecords.ID";

            return(db.ExecuteDataSet(strSQL, oleConn).Tables[0]);
        }
        /// <summary>
        /// 获取已离开学生请假表
        /// </summary>
        /// <returns></returns>
        public DataTable GetPersonLeavesTable()
        {
            string strSQL = "SELECT StudentBasicInfo.ID,StudentBasicInfo.TEAM,StudentBasicInfo.CLASS,StudentBasicInfo.NAME,StudentBasicInfo.IsPartyMember,StudentBasicInfo.IsCadre,StudentLeaveRecords.LEAVEDATE,StudentLeaveRecords.DUEDATE,StudentLeaveRecords.ISBACK,StudentLeaveRecords.RETURNDATE FROM StudentBasicInfo INNER JOIN StudentLeaveRecords ON StudentBasicInfo.ID = StudentLeaveRecords.ID where StudentLeaveRecords.ISBACK=false order by StudentLeaveRecords.LEAVEDATE";

            return(db.ExecuteDataSet(strSQL, oleConn).Tables[0]);
        }
        /// <summary>
        /// 获取在位人员
        /// </summary>
        /// <param name="Grade"></param>
        /// <returns></returns>
        public DataTable GetStayPersonInfoTable(string Grade)
        {
            string    strSQL = "select * from StudentBasicInfo where GRADE='" + Grade + "' and ID not in(select ID from StudentLeaveRecords where ISBACK=false)";
            DataSet   ds     = db.ExecuteDataSet(strSQL, oleConn);
            DataTable dt     = ds.Tables[0];

            return(dt);
        }