예제 #1
0
파일: Form2_41.cs 프로젝트: jinghehehe/-
        private void button1_Click(object sender, EventArgs e)
        {
            String No = textBox1.Text.Trim();
            //构造sql查询语句
            String        sql = "select * from College1 S where S.Stu_no='" + No + "'";
            Sqlmodel      sm  = new Sqlmodel(sql);
            SqlDataReader sdr = sm.Search();

            if (sdr.HasRows)
            {
                // MessageBox.Show("查询成功!\n");

                /* String str = "";
                 * while (sdr.Read())
                 * {
                 * str += "***************************"+"\n学号:" + sdr.GetValue(0) + "\n姓名:" + sdr.GetValue(1) + "\n性别:" + sdr.GetValue(2)
                 + "\n出生年月:" + sdr.GetValue(3) + "\n学院号:" + sdr.GetValue(4) + "\n专业号:" + sdr.GetValue(5)
                 + "\n班级号:" + sdr.GetValue(6) + "\n***************************\n";
                 + }
                 + MessageBox.Show(str);*/
                Form3_12 form = new Form3_12(sdr);
                form.Show();
            }
            else
            {
                MessageBox.Show("查询失败或你输入的ID并不存在!");
            }
        }
예제 #2
0
        private void 老人实时信息ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            String        sql = "select * from College1 S where S.Stu_no='" + Name + "'";
            Sqlmodel      sm  = new Sqlmodel(sql);
            SqlDataReader sdr = sm.Search();

            if (sdr.HasRows)
            {
                // MessageBox.Show("查询成功!\n");

                /* String str = "";
                 * while (sdr.Read())
                 * {
                 * str += "***************************"+"\n学号:" + sdr.GetValue(0) + "\n姓名:" + sdr.GetValue(1) + "\n性别:" + sdr.GetValue(2)
                 + "\n出生年月:" + sdr.GetValue(3) + "\n学院号:" + sdr.GetValue(4) + "\n专业号:" + sdr.GetValue(5)
                 + "\n班级号:" + sdr.GetValue(6) + "\n***************************\n";
                 + }
                 + MessageBox.Show(str);*/
                Form3_12 form = new Form3_12(sdr);
                form.Show();
            }
            else
            {
                MessageBox.Show("查询失败!");
            }
        }