Пример #1
0
        public void MyClassTable()
        {
            dataGridView1.Rows.Clear();//清空旧数据
            pipe        pip = new pipe();
            string      sql = $"select * from SelectClassTB WHERE StuID = '{StuData.StuID}'";
            IDataReader dc = pip.read(sql);
            string      a0, a1;

            while (dc.Read())
            {
                a0 = dc[1].ToString();//便于对数据进行处理
                a1 = dc[2].ToString();
                string[] table = { a0, a1 };
                dataGridView1.Rows.Add(table);
            }
            dc.Close();
            pip.PipClose();
        }
Пример #2
0
        public void LeadinStuInfo()
        {
            pipe        pip = new pipe();
            string      sql = $"select * from StuInfoTB where StuID='{StuData.StuID}'";
            IDataReader dc  = pip.read(sql);

            if (dc.Read())
            {
                string name     = dc[1].ToString();
                string classnum = dc[3].ToString();
                string credit   = dc[2].ToString();
                label6.Text = classnum;
                label5.Text = credit;
            }
            else
            {
                MessageBox.Show("读取学生信息失败");
            }
        }
Пример #3
0
        public void ClassInfoTB()       //从数据库读取数据显示在可选表格中
        {
            dataGridView2.Rows.Clear(); //清空就数据
            pipe        pip = new pipe();
            string      sql = "select * from ClassInfoTB";
            IDataReader dc = pip.read(sql);
            string      a0, a1, a2, a3;

            while (dc.Read())
            {
                a0 = dc[0].ToString();//便于对数据进行处理
                a1 = dc[2].ToString();
                a2 = dc[1].ToString();
                a3 = dc[3].ToString();
                string[] table = { a0, a1, a2, a3 };
                dataGridView2.Rows.Add(table);
            }
            dc.Close();
            pip.PipClose();
        }
Пример #4
0
 private void tbStuID_TextChanged(object sender, EventArgs e)
 {
     if (tbStuID.Text.Length == 10)
     {
         //查询学号
         pipe        pip = new pipe();
         string      sql = $"select * from StuInfoTB where StuID='{tbStuID.Text}'";
         IDataReader dc  = pip.read(sql);
         if (dc.Read())
         {
             string name = dc[1].ToString();
             label4.Text     = name;
             StuData.StuName = name;
         }
         else
         {
             MessageBox.Show("查询失败");
         }
         pip.PipClose();
     }
 }
Пример #5
0
        public void SelectClassTB()
        {
            dataGridView1.Rows.Clear();//清空就数据
            pipe        pip = new pipe();
            string      sql = $"select * from TempSelectClassTB where StuID = '{StuData.StuID}'";
            IDataReader dc = pip.read(sql);
            string      a0, a1;
            int         classnum = 0;
            int         credit   = 0;

            while (dc.Read())
            {
                a0 = dc[1].ToString();//便于对数据进行处理
                a1 = dc[2].ToString();
                string[] table = { a0, a1 };
                dataGridView1.Rows.Add(table);
                classnum++;
                credit += int.Parse(a1);
            }

            dc.Close();
            pip.PipClose();
        }