Exemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            //导入学生名单
            String dirup = null;

            studentlist = null;

            // Microsoft.Win32.OpenFileDialog ofd = new Microsoft.Win32.OpenFileDialog();
            openFileDialog1.DefaultExt = ".xlsx";
            openFileDialog1.Filter     = "xlsx file|*.xlsx";
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                dirup = openFileDialog1.FileName;
                DB_exceltool.getstudentsfromexcel2(dirup);
                DB_exceltool.savestudents(cls[selindex].classid);

                // studentlist = DB_exceltool.studentList;
                studentlist = DB_exceltool.searchstubyclassid(cls[selindex].classid);


                if (studentlist.Count != 0)
                {
                    // ((this.FindName("DG1")) as DataGrid).ItemsSource = peopleList;
                    dataGridView1.DataSource = studentlist;
                }
                // DB_exceltool.savestudents(1);
            }
            //end 导入
        }
Exemplo n.º 2
0
        private void button2_Click(object sender, EventArgs e)
        {
            //////
            studentlist = null;

            studentlist = DB_exceltool.searchstubyclassid(cls[selindex].classid);


            if (studentlist.Count != 0)
            {
                // ((this.FindName("DG1")) as DataGrid).ItemsSource = peopleList;
                dataGridView1.DataSource = studentlist;
            }



            //////
        }