예제 #1
0
        private void renewtree()
        {
            label3.Text = treeView1.SelectedNode.Parent.Text + "专业  " + treeView1.SelectedNode.Text + "课程成绩";
            SQLConnet sqlconnet = new SQLConnet();
            //课程数据
            DataTable dtcourse = new DataTable();

            dtcourse.Columns.Add("Value");
            dtcourse.Columns.Add("Name");
            SqlDataReader course = sqlconnet.readrow("select CName from courseinfo where MName='" + treeView1.SelectedNode.Parent.Text + "'");
            DataRow       drcourse;

            while (course.Read())
            {
                drcourse    = dtcourse.NewRow();
                drcourse[0] = course["CName"];
                drcourse[1] = course["CName"];
                dtcourse.Rows.Add(drcourse);
            }
            course.Close();
            课程名称.ValueMember         = "Value";
            课程名称.DisplayMember       = "Name";
            课程名称.DataSource          = dtcourse;
            dataGridView1.DataSource = sqlconnet.getdatatable("select * from scoreinfo where CName='" + treeView1.SelectedNode.Text + "'", "scoreinfo");
            sqlconnet.close();
            treeView1.Focus();
        }
예제 #2
0
        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            label3.Text = e.Node.Text + "专业学生表";
            SQLConnet sqlconnet = new SQLConnet();

            dataGridView1.DataSource = sqlconnet.getdatatable("select * from studentinfo where MName='" + e.Node.Text + "'", "studentinfo");
            sqlconnet.close();
        }
예제 #3
0
        private void setdatagirdview()
        {
            SQLConnet sqlconnet = new SQLConnet();
            DataTable sqltable  = sqlconnet.getdatatable("select * from majorinfo", "majorinfo");

            label3.Text = "共有" + sqltable.Rows.Count + "条记录";
            dataGridView1.DataSource = sqltable;
            sqlconnet.close();
        }
예제 #4
0
        private void renewtree()
        {
            SQLConnet sqlconnet = new SQLConnet();

            dataGridView1.DataSource = sqlconnet.getdatatable("select * from studentinfo where MName='" + treeView1.SelectedNode.Text + "'", "studentinfo");

            sqlconnet.close();
            treeView1.Focus();
        }