public StatisticsClass_City()
        {
            //
            // Windows 窗体设计器支持所必需的
            //
            InitializeComponent();

            /*
             * Count(*) AS CountHowmany
             * ["CountHowmany"].ToString();
             *
             * string str_Sql="Select * from Class";
             * string errorstring=conn.Fill(str_Sql);
             * label_ClassCount.Text=conn.ds.Tables[0].Rows.Count.ToString();*/

            string str_Sql     = "Select Count(*) AS CountHowmany from Class";
            string errorstring = conn.Fill(str_Sql);

            label_ClassCount.Text = conn.ds.Tables[0].Rows[0]["CountHowmany"].ToString();

            conn.ds.Clear();
            str_Sql     = "Select * from View_City_Class_Statistics";
            errorstring = conn.Fill(str_Sql);
            DataGrid1.SetDataBinding(conn.ds, "TableIn");

            DataGridTableStyle MyStyle = new DataGridTableStyle();

            MyStyle.MappingName = "TableIn";
            DataGrid1.TableStyles.Add(MyStyle);
            //
            // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
            //
        }
        public SearchSchool()
        {
            //
            // Windows 窗体设计器支持所必需的
            //
            InitializeComponent();

            conn.BindComboBox("SELECT QuXian_Code,QuXian_Name FROM QuXian", comboBox_QuXian, "QuXian_Code", "QuXian_Name");
            conn.BindComboBox("SELECT School_Type_ID,School_Type_Name FROM School_Type", comboBox_School_Type, "School_Type_ID", "School_Type_Name");

            //绑定DataGrid显示
            string str_Sql, errorstring;

            str_Sql     = "SELECT School_ID AS 学校代码,School_Name AS 学校名称,School_Type_Name AS 学校类别,Schoolmaster AS 校长,School_Tel AS 电话,School_Zip AS 邮政编码,School_Address AS 学校地址,School_Type_Year AS 学校学制年限,Student_Count AS 学生人数,Teacher_Count AS 教师人数 FROM View_School Order By School_Type_ID,School_ID";
            errorstring = conn.Fill(str_Sql);
            if (errorstring != "OK")
            {
                MessageBox.Show("请检查数据库!" + errorstring, "提醒!",
                                MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                button1.Enabled = false;
                return;
            }
            DataGrid1.SetDataBinding(conn.ds, "TableIn");

            //
            // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
            //
        }
        public StatisticsTeacher_QuXian()
        {
            //
            // Windows 窗体设计器支持所必需的
            //
            InitializeComponent();

            conn.BindComboBox("Select * FROM QuXian WHERE QuXian_ID<>9", comboBox_QuXian, "QuXian_Code", "QuXian_Name");

            /*
             * Count(*) AS CountHowmany
             * [0]["CountHowmany"].ToString();
             *
             * string str_Sql="Select * from View_Teacher WHERE QuXian_Code='"+comboBox_QuXian.SelectedValue.ToString()+"'";
             * string errorstring=conn.Fill(str_Sql);
             * label_SchoolCount.Text=conn.ds.Tables[0].Rows.Count.ToString();*/
            string str_Sql     = "Select Count(*) AS CountHowmany from View_Teacher WHERE QuXian_Code='" + comboBox_QuXian.SelectedValue.ToString() + "'";
            string errorstring = conn.Fill(str_Sql);

            label_SchoolCount.Text = conn.ds.Tables[0].Rows[0]["CountHowmany"].ToString();

            //conn.ds.Clear();
            str_Sql     = "select * FROM View_QuXian_Teacher_Statistics WHERE 区县代码='" + comboBox_QuXian.SelectedValue.ToString() + "'";
            errorstring = conn.Fill(str_Sql);
            DataGrid1.SetDataBinding(conn.ds, "TableIn");

            DataGridTableStyle MyStyle = new DataGridTableStyle();

            MyStyle.MappingName = "TableIn";
            DataGrid1.TableStyles.Add(MyStyle);
            //
            // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
            //
        }
Esempio n. 4
0
        public DeleteUser()
        {
            //
            // Windows 窗体设计器支持所必需的
            //
            InitializeComponent();

            //显示当前所有用户的DataGrid
            string str_Sql, errorstring;

            str_Sql     = "SELECT UserName AS 用户名,PassWord AS 密码,ReadOnly AS 仅为只读用户 FROM Users";
            errorstring = conn.Fill(str_Sql);
            if (errorstring != "OK")
            {
                MessageBox.Show("请检查本地数据库!" + errorstring, "提醒!",
                                MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                button1.Enabled = false;
                return;
            }
            DataGrid1.SetDataBinding(conn.ds, "TableIn");
            button1.Enabled = false;
            //
            // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
            //
        }
        public SearchTeacher()
        {
            //
            // Windows 窗体设计器支持所必需的
            //
            InitializeComponent();

            conn.BindComboBox("SELECT QuXian_Code,QuXian_Name FROM QuXian", comboBox_QuXian, "QuXian_Code", "QuXian_Name");

            //绑定DataGrid显示
            string str_Sql, errorstring;

            str_Sql     = "SELECT Teacher_ID As 身份证号码,Name As 姓名,Sex AS 性别,convert(char(10),Birthday,120) As 出生日期,convert(char(10),WorkTime,120) As 参加工作时间,SchoolType AS 学历,PostCan AS 职称,PostIn AS 职务,SchoolGrad AS 毕业院校,convert(char(10),GradTime,120)  毕业日期,SpecialIn AS 所学专业,InWorkSheet As 在编,IsFullTime AS 专任教师,LessonTeach AS 担任课程 FROM Teacher WHERE School_ID='000'";
            errorstring = conn.Fill(str_Sql);
            if (errorstring != "OK")
            {
                MessageBox.Show("请检查数据库!" + errorstring, "提醒!",
                                MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                button1.Enabled = false;
                return;
            }
            DataGrid1.SetDataBinding(conn.ds, "TableIn");

            DataGridTableStyle MyStyle = new DataGridTableStyle();

            MyStyle.MappingName = "TableIn";
            DataGrid1.TableStyles.Add(MyStyle);
            MyStyle.GridColumnStyles["身份证号码"].Width = 120;
            MyStyle.GridColumnStyles["性别"].Width    = 30;
            MyStyle.GridColumnStyles["在编"].Width    = 30;
            MyStyle.GridColumnStyles["专任教师"].Width  = 60;
            //
            // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
            //
        }
        public AddClass_Type()
        {
            //
            // Windows 窗体设计器支持所必需的
            //
            InitializeComponent();

            //按数据库里边存储的学校类型绑定下拉列表

            string str_Sql, errorstring;

            errorstring = conn.BindComboBox("Select * from School_Type", comboBox1_School_Type, "School_Type_ID", "School_Type_Name");
            if (errorstring != "OK")
            {
                MessageBox.Show("请检查数据库!" + errorstring, "提醒!",
                                MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                button1.Enabled = false;
                return;
            }

            //按学校类型代码内联显示学校类型的名称,绑定DataGrid显示
            str_Sql = "SELECT Class_Type.Class_Type_ID AS 班级类别代码,Class_Type.Class_Type_Name AS 班级类别名,School_Type.School_Type_Name AS 学校类别名 FROM Class_Type inner join School_Type on Class_Type.School_Type_ID_Class_Belong=School_Type.School_Type_ID";
            if (conn.GetRowCount(str_Sql) == 0)
            {
                MessageBox.Show("请检查数据库!", "警告!",
                                MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                this.Dispose();
            }
            conn.Fill(str_Sql);
            DataGrid1.SetDataBinding(conn.ds, "TableIn");
            textBox_Class_Type_ID.Text = conn.GetMaxId("Class_Type_ID", "Class_Type");
            //
            // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
            //
        }
        public maintenanceOffice()
        {
            //
            // Windows 窗体设计器支持所必需的
            //
            InitializeComponent();

            //绑定下拉列表显示现有的所有区县
            string str_Sql, errorstring;

            errorstring = conn.BindComboBox("Select * from QuXian WHERE QuXian_ID<>9", comboBox1_QuXian, "QuXian_ID", "QuXian_Name");
            if (errorstring != "OK")
            {
                MessageBox.Show("请检查数据库!" + errorstring, "提醒!",
                                MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                button1.Enabled = false;
                return;
            }
            //绑定DataGrid显示,未选中任何有效的项button1.Enabled=false;
            str_Sql = "SELECT Office.Office_ID AS 办事处代码,Office.Office_Name AS 办事处名称,QuXian.QuXian_Name AS 所在区县 FROM Office  inner join QuXian  on Office.QuXian_ID_OfficeIn=QuXian.QuXian_ID ";
            conn.Fill(str_Sql);
            DataGrid1.SetDataBinding(conn.ds, "TableIn");
            button1.Enabled = false;
            //
            // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
            //
        }
        public maintenanceCommittee()
        {
            //
            // Windows 窗体设计器支持所必需的
            //
            InitializeComponent();
            //绑定下拉列表显示现有的所有区县
            string str_Sql, errorstring;

            errorstring = conn.BindComboBox("Select * from QuXian WHERE QuXian_ID<>9", comboBox_QuXian, "QuXian_ID", "QuXian_Name");
            if (errorstring != "OK")
            {
                MessageBox.Show("请检查数据库!" + errorstring, "提醒!",
                                MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                button1.Enabled = false;
                return;
            }
            //绑定DataGrid显示,未选中任何有效的项button1.Enabled=false;
            str_Sql = "SELECT Committee_ID AS 居委会代码,Committee_Name AS 居委会名称,Office_Name AS 办事处名称,QuXian_Name AS 区县名称 FROM View_Committee";

            conn.Fill(str_Sql);
            DataGrid1.SetDataBinding(conn.ds, "TableIn");

            textBox_Committee_ID.Text = conn.GetMaxId("Committee_ID", "Committee");

            //
            // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
            //
        }
        public ModifySchool()
        {
            //
            // Windows 窗体设计器支持所必需的
            //
            InitializeComponent();

            string str_Sql, errorstring;

            errorstring = conn.BindComboBox("Select * from School_Type", comboBox1_School_Type, "School_Type_ID", "School_Type_Name");
            if (errorstring != "OK")
            {
                MessageBox.Show("请检查数据库!" + errorstring, "提醒!",
                                MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                button1.Enabled = false;
                return;
            }

            //绑定DataGrid显示,未选中任何有效的项button1.Enabled=false;
            conn.BindComboBox("Select * from School_Type", comboBox1_School_Type, "School_Type_ID", "School_Type_Name");

            str_Sql = "SELECT School_ID AS 学校代码,School_Name AS 学校名称,School_Type_Name AS 学校类别,Schoolmaster AS 校长,School_Tel AS 电话,School_Zip AS 邮政编码,School_Address AS 学校地址,School_Type_Year AS 学校学制年限 FROM View_School Order By School_Type_ID,School_ID";
            conn.Fill(str_Sql);
            DataGrid1.SetDataBinding(conn.ds, "TableIn");

            button1.Enabled = false;
            //
            // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
            //
        }
Esempio n. 10
0
        public Add_Office()
        {
            //
            // Windows 窗体设计器支持所必需的
            //
            InitializeComponent();

            //按数据库里边存储的区县绑定下拉列表
            string str_Sql, errorstring;

            errorstring = conn.BindComboBox("Select * from QuXian WHERE QuXian_ID<>9", comboBox1_QuXian_ID, "QuXian_ID", "QuXian_Name");
            if (errorstring != "OK")
            {
                MessageBox.Show("请检查数据库!" + errorstring, "提醒!",
                                MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                button1.Enabled = false;
                return;
            }

            //按区县代码内联显示区县名称,绑定DataGrid显示
            str_Sql = "SELECT Office.Office_ID AS 办事处代码,Office.Office_Name AS 办事处名称,QuXian.QuXian_Name AS 区县名称 FROM QuXian inner join Office on QuXian.QuXian_ID=Office.QuXian_ID_OfficeIn";

            conn.Fill(str_Sql);
            DataGrid1.SetDataBinding(conn.ds, "TableIn");

            textBox_Office_ID.Text = conn.GetMaxId("Office_ID", "Office");
            //
            // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
            //
        }
        public maintenanceClassType()
        {
            //
            // Windows 窗体设计器支持所必需的
            //
            InitializeComponent();

            //绑定DataGrid显示,未选中任何有效的项button1.Enabled=false;
            string str_Sql, errorstring;

            str_Sql     = "SELECT Class_Type.Class_Type_ID AS 班级类别代码,Class_Type.Class_Type_Name AS 班级类别名,School_Type.School_Type_Name AS 学校类别名 FROM Class_Type inner join School_Type on Class_Type.School_Type_ID_Class_Belong=School_Type.School_Type_ID";
            errorstring = conn.Fill(str_Sql);
            if (errorstring != "OK")
            {
                MessageBox.Show("请检查数据库!" + errorstring, "提醒!",
                                MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                button1.Enabled = false;
                return;
            }
            DataGrid1.SetDataBinding(conn.ds, "TableIn");
            button1.Enabled = false;
            //
            // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
            //
        }
Esempio n. 12
0
        public AddQuXian()
        {
            //
            // Windows 窗体设计器支持所必需的
            //
            InitializeComponent();

            //绑定DataGrid显示
            string str_Sql, errorstring;

            str_Sql     = "SELECT QuXian.QuXian_ID AS 区县代码,QuXian.QuXian_Name AS 区县名称 FROM QuXian";
            errorstring = conn.Fill(str_Sql);
            if (errorstring != "OK")
            {
                MessageBox.Show("请检查数据库!" + errorstring, "提醒!",
                                MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                button1.Enabled = false;
                return;
            }

            DataGrid1.SetDataBinding(conn.ds, "TableIn");

            textBox_QuXian_ID.Text = conn.GetMaxId("QuXian_ID", "QuXian");
            //
            // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
            //
        }
        public AddSchool_Type()
        {
            //
            // Windows 窗体设计器支持所必需的
            //
            InitializeComponent();

            string str_Sql, errorstring;

            str_Sql     = "SELECT School_Type_ID As 学校类别代码,School_Type_Name As 学校类别名,School_Type_Year As 学校类别学制 FROM School_Type";
            errorstring = conn.Fill(str_Sql);
            if (errorstring != "OK")
            {
                MessageBox.Show("请检查数据库!" + errorstring, "提醒!",
                                MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                button1.Enabled = false;
                return;
            }
            DataGrid1.SetDataBinding(conn.ds, "TableIn");

            textBox_School_Type_ID.Text = conn.GetMaxId("School_Type_ID", "School_Type");

            //
            // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
            //
        }
        private void button1_Click(object sender, System.EventArgs e)
        {
            //测试数据库
            string str_Sql     = "SELECT School_ID,School_Name,School_Type_ID,Schoolmaster,School_Tel,School_Zip,School_Address FROM School";
            string errorstring = conn.Fill(str_Sql);

            if (errorstring != "OK")
            {
                MessageBox.Show("请检查数据库!" + errorstring, "提醒!",
                                MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                button1.Enabled = false;
                return;
            }

            str_Sql = "SELECT School_ID,School_Name,School_Type_ID,Schoolmaster,School_Tel,School_Zip,School_Address,QuXian_Code FROM School WHERE School_ID Like '____" + comboBox_QuXian.SelectedValue + "%'";
            conn.Fill(str_Sql);
            conn.ds.WriteXmlSchema(textBox_LocationDBOut.Text + "\\School.xsd");
            conn.ds.WriteXml(textBox_LocationDBOut.Text + "\\School.xml");

            str_Sql = "SELECT Class_ID,School_ID,Class_Type_ID,Class_Name,TeacherInCharge FROM Class  WHERE School_ID Like '____" + comboBox_QuXian.SelectedValue + "%'";
            conn.Fill(str_Sql);
            conn.ds.WriteXmlSchema(textBox_LocationDBOut.Text + "\\Class.xsd");
            conn.ds.WriteXml(textBox_LocationDBOut.Text + "\\Class.xml");

            str_Sql = "SELECT Student_ID,School_ID,Class_ID,Name,Sex,Birthday,Father,Mother,Keeper,StudentTel,QuXian_ID,Office_ID,Committee_ID,Student_Address,Father_Job,Father_XueLi,Mother_Job,Mother_XueLi FROM Student  WHERE School_ID Like '____" + comboBox_QuXian.SelectedValue + "%'";
            conn.Fill(str_Sql);
            conn.ds.WriteXmlSchema(textBox_LocationDBOut.Text + "\\Student.xsd");
            conn.ds.WriteXml(textBox_LocationDBOut.Text + "\\Student.xml");

            str_Sql = "SELECT School_ID,Teacher_ID,Name,Sex,Birthday,WorkTime,SchoolType,PostCan,PostIn,SchoolGrad,GradTime,SpecialIn,InWorkSheet,IsFullTime,LessonTeach FROM Teacher  WHERE School_ID Like '____" + comboBox_QuXian.SelectedValue + "%'";
            conn.Fill(str_Sql);
            conn.ds.WriteXmlSchema(textBox_LocationDBOut.Text + "\\Teacher.xsd");
            conn.ds.WriteXml(textBox_LocationDBOut.Text + "\\Teacher.xml");

            /*
             * StreamWriter sw=new StreamWriter(textBox_LocationDBOut.Text+"\\UploadPassword.xml",false,Encoding.GetEncoding("gb2312"));
             * try
             * {
             *      sw.Write(textBox_UploadPassword.Text);
             * }
             * catch
             * {
             *      MessageBox.Show("上传密码存储出错!"+errorstring, "提醒!",
             *              MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
             * }
             * try
             * {
             *      sw.Close();
             * }
             * catch
             * {
             *      MessageBox.Show("上传密码存储出错!"+errorstring, "提醒!",
             *       MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
             * },UploadPassword.xml七*/

            MessageBox.Show("请检查" + textBox_LocationDBOut.Text + "处是否有School.xml,Class.xml,Student.xml,Teacher.xml,Teacher.xsd,School.xsd,Class.xsd,Student.xsd八个文件!请全部拷贝上报", "提醒!",
                            MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
        }
        public SearchBrowseStudent()
        {
            //
            // Windows 窗体设计器支持所必需的
            //
            InitializeComponent();

            //测试数据连接
            string errorstring;

            errorstring = conn.ExeSql("Select * FROM School");
            if (errorstring != "OK")
            {
                MessageBox.Show("请检查本地数据库!" + errorstring, "提醒!",
                                MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                button1.Enabled = false;
                return;
            }

            string str_Sql = "Select * from Class";

            if (conn.GetRowCount(str_Sql) == 0)
            {
                MessageBox.Show("请先输入班级信息!", "警告!",
                                MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                button1.Enabled = false;
                return;
            }

            //conn.BindComboBox("Select * FROM School Order By School_Type_ID,School_ID",comboBox_School,"School_ID","School_Name");
            conn.BindComboBox("SELECT QuXian_Code,QuXian_Name FROM QuXian", comboBox_QuXian, "QuXian_Code", "QuXian_Name");
            conn.BindComboBox("SELECT QuXian_ID,QuXian_Name FROM QuXian", comboBox_Student_QuXian, "QuXian_ID", "QuXian_Name");

            str_Sql     = "SELECT School_Name AS 学校名称,Class_Type_Name AS 年级,Class_Name AS 班级,Student_ID As 身份证号码,Name As 姓名,Sex AS 性别,convert(char(10),Birthday,120) As 出生日期,Father AS 父亲,Mother AS 母亲,Keeper AS 监护人,StudentTel AS 联系电话,Student_Address AS 家庭住址,Father_Job AS 父亲职业,Father_XueLi AS 父亲学历,Mother_Job AS 母亲职业,Mother_XueLi AS 母亲学历 FROM View_StudentClass_Detail_City Where School_ID='000'";      //"+comboBox_School.SelectedValue+"'";
            errorstring = conn.Fill(str_Sql);
            if (errorstring != "OK")
            {
                MessageBox.Show("查找失败!请检查数据库!" + errorstring, "提醒!",
                                MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                button1.Enabled = false;
                return;
            }
            DataGrid1.SetDataBinding(conn.ds, "TableIn");

            DataGridTableStyle MyStyle = new DataGridTableStyle();

            MyStyle.MappingName = "TableIn";
            DataGrid1.TableStyles.Add(MyStyle);
            MyStyle.GridColumnStyles["学校名称"].Width  = 150;
            MyStyle.GridColumnStyles["身份证号码"].Width = 120;
            MyStyle.GridColumnStyles["性别"].Width    = 30;
            MyStyle.GridColumnStyles["家庭住址"].Width  = 200;
            MyStyle.GridColumnStyles["联系电话"].Width  = 80;

            //
            // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
            //
        }
        private void button_QuXian_Click(object sender, System.EventArgs e)
        {
            button1.Enabled = true;

            //绑定DataGrid显示
            string str_Sql = "select QuXian_Name AS 区县,Count(Student_ID) AS 学生数 FROM View_StudentClass_Detail_City4 Group By QuXian_Name";

            conn.Fill(str_Sql);
            DataGrid1.SetDataBinding(conn.ds, "TableIn");
        }
Esempio n. 17
0
        private void button1_Click(object sender, System.EventArgs e)
        {
            bool   HadSome = false;
            string errorstring, str_Sql = "Select * FROM School";

            DialogResult result = MessageBox.Show(this, "真的要进行删除吗?", "提醒!", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

            if (result == DialogResult.OK)
            {
                //条件有输入的内容则参与查找,查找到的内容和DataGrid绑定
                if (checkBox_InQuXian.Checked == true && checkBox_School_Type.Checked == false)
                {
                    str_Sql = "Select * FROM School WHERE School_ID Like '____" + comboBox_QuXian.SelectedValue + "%'";
                    HadSome = true;
                }

                //条件有输入的内容则参与查找,查找到的内容和DataGrid绑定
                if (checkBox_InQuXian.Checked == false && checkBox_School_Type.Checked == true)
                {
                    str_Sql = "Select * FROM School WHERE School_Type_ID=" + comboBox_School_Type.SelectedValue;
                    HadSome = true;
                }

                //条件有输入的内容则参与查找,查找到的内容和DataGrid绑定
                if (checkBox_InQuXian.Checked == true && checkBox_School_Type.Checked == true)
                {
                    str_Sql = "Select * FROM School WHERE School_Type_ID=" + comboBox_School_Type.SelectedValue + " AND School_ID Like '____" + comboBox_QuXian.SelectedValue + "%'";
                    HadSome = true;
                }

                int i = conndelete.GetRowCount(str_Sql);
                conndelete.Fill(str_Sql);

                if (HadSome == true && i > 0)
                {
                    for (; i > 0; i--)
                    {
                        conndelete.dr = conndelete.ds.Tables[0].Rows[i - 1];

                        str_Sql     = "DELETE from Student WHERE School_ID='" + conndelete.dr["School_ID"].ToString() + "'";
                        errorstring = conn.ExeSql(str_Sql);

                        str_Sql     = "DELETE from Class WHERE School_ID='" + conndelete.dr["School_ID"].ToString() + "'";
                        errorstring = conn.ExeSql(str_Sql);

                        str_Sql     = "DELETE from Teacher WHERE School_ID='" + conndelete.dr["School_ID"].ToString() + "'";
                        errorstring = conn.ExeSql(str_Sql);

                        str_Sql     = "DELETE from School WHERE School_ID='" + conndelete.dr["School_ID"].ToString() + "'";
                        errorstring = conn.ExeSql(str_Sql);
                    }
                }
                MessageBox.Show("成功删除!", "提醒!",
                                MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
            else
            {
                return;
            }
        }
        public QuXianDataIn()
        {
            //
            // Windows 窗体设计器支持所必需的
            //
            InitializeComponent();

            string str_Sql, errorstring;

            str_Sql     = "SELECT School_Type_ID As 学校类别代码,School_Type_Name As 学校类别名,School_Type_Year As 学校类别学制 FROM School_Type";
            errorstring = connSchool.Fill(str_Sql);
            errorstring = conn.Fill(str_Sql);

            str_Sql     = "SELECT * FROM Class_Type";
            errorstring = connClass.Fill(str_Sql);

            str_Sql     = "SELECT * FROM Class_Type";
            errorstring = connTeacher.Fill(str_Sql);

            str_Sql     = "SELECT * FROM Class_Type";
            errorstring = connStudent.Fill(str_Sql);

            if (errorstring != "OK")
            {
                MessageBox.Show("请检查数据库!" + errorstring, "提醒!",
                                MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                this.Dispose();
            }
            //
            // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
            //
        }
Esempio n. 19
0
        public DeleteOld()
        {
            //
            // Windows 窗体设计器支持所必需的
            //
            InitializeComponent();

            string str_Sql = "SELECT School_ID AS 学校代码,School_Name AS 学校名称,School_Type_Name AS 学校类别,Schoolmaster AS 校长,School_Tel AS 电话,School_Zip AS 邮政编码,School_Address AS 学校地址,School_Type_Year AS 学校学制年限 FROM View_School";

            conn.Fill(str_Sql);
            DataGrid1.SetDataBinding(conn.ds, "TableIn");

            button1.Enabled = false;
            //
            // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
            //
        }
Esempio n. 20
0
        public StatisticsStudent_City()
        {
            //
            // Windows 窗体设计器支持所必需的
            //
            InitializeComponent();

            /*
             * string str_Sql="Select School_ID,Student_ID from Student";
             * string errorstring=conn.Fill(str_Sql);
             * label_StudentCount.Text=conn.ds.Tables[0].Rows.Count.ToString();*/

            string str_Sql     = "Select Count(*) AS CountHowmany from Student";
            string errorstring = conn.Fill(str_Sql);

            label_StudentCount.Text = conn.ds.Tables[0].Rows[0]["CountHowmany"].ToString();

            conn.ds.Clear();
            str_Sql     = "Select School_ID,Student_ID from View_StudentClass Where Class_Type_ID=12 OR Class_Type_ID=13 OR Class_Type_ID=14";
            errorstring = conn.Fill(str_Sql);
            label_Class_Type_ID_chu.Text = conn.ds.Tables[0].Rows.Count.ToString();

            conn.ds.Clear();
            str_Sql     = "Select School_ID,Student_ID from View_StudentClass Where Class_Type_ID=15 OR Class_Type_ID=16 OR Class_Type_ID=17";
            errorstring = conn.Fill(str_Sql);
            label_Class_Type_ID_gao.Text = conn.ds.Tables[0].Rows.Count.ToString();

            conn.ds.Clear();
            str_Sql     = "Select * from View_City_Student_Statistics";
            errorstring = conn.Fill(str_Sql);
            DataGrid1.SetDataBinding(conn.ds, "TableIn");

            DataGridTableStyle MyStyle = new DataGridTableStyle();

            MyStyle.MappingName = "TableIn";
            DataGrid1.TableStyles.Add(MyStyle);
            //
            // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
            //
        }
        public StatisticsStudent_QuXian()
        {
            //
            // Windows 窗体设计器支持所必需的
            //
            InitializeComponent();

            conn.BindComboBox("Select * FROM QuXian WHERE QuXian_ID<>9", comboBox_QuXian, "QuXian_Code", "QuXian_Name");

            /*
             * Count(*) AS CountHowmany
             * [0]["CountHowmany"].ToString();
             *
             * string str_Sql="Select * from View_StudentSchool WHERE QuXian_Code='"+comboBox_QuXian.SelectedValue.ToString()+"'";
             * string errorstring=conn.Fill(str_Sql);
             * label_Count.Text=conn.ds.Tables[0].Rows.Count.ToString();*/

            string str_Sql     = "Select Count(*) AS CountHowmany from View_StudentSchool WHERE QuXian_Code='" + comboBox_QuXian.SelectedValue.ToString() + "'";
            string errorstring = conn.Fill(str_Sql);

            label_Count.Text = conn.ds.Tables[0].Rows[0]["CountHowmany"].ToString();

            conn.ds.Clear();
            str_Sql     = "Select View_StudentClass.School_ID,Student_ID from View_StudentClass inner join School on View_StudentClass.School_ID=School.School_ID Where (Class_Type_ID=12 OR Class_Type_ID=13 OR Class_Type_ID=14) AND School.QuXian_Code='" + comboBox_QuXian.SelectedValue.ToString() + "'";
            errorstring = conn.Fill(str_Sql);
            label_Class_Type_ID_chu.Text = conn.ds.Tables[0].Rows.Count.ToString();

            conn.ds.Clear();
            str_Sql     = "Select View_StudentClass.School_ID,Student_ID from View_StudentClass inner join School on View_StudentClass.School_ID=School.School_ID Where (Class_Type_ID=15 OR Class_Type_ID=16 OR Class_Type_ID=17) AND School.QuXian_Code='" + comboBox_QuXian.SelectedValue.ToString() + "'";
            errorstring = conn.Fill(str_Sql);
            label_Class_Type_ID_gao.Text = conn.ds.Tables[0].Rows.Count.ToString();

            conn.ds.Clear();
            str_Sql     = "select * FROM View_QuXian_Student_Statistics WHERE 区县代码='" + comboBox_QuXian.SelectedValue.ToString() + "'";
            errorstring = conn.Fill(str_Sql);
            DataGrid1.SetDataBinding(conn.ds, "TableIn");

            DataGridTableStyle MyStyle = new DataGridTableStyle();

            MyStyle.MappingName = "TableIn";
            DataGrid1.TableStyles.Add(MyStyle);
            //
            // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
            //
        }
Esempio n. 22
0
        public Add_Committee()
        {
            //
            // Windows 窗体设计器支持所必需的
            //
            InitializeComponent();

            //按数据库里边存储的区县绑定下拉列表
            string str_Sql, errorstring;

            errorstring = conn.BindComboBox("Select * from QuXian WHERE QuXian_ID<>9", comboBox_QuXian, "QuXian_ID", "QuXian_Name");
            if (errorstring != "OK")
            {
                MessageBox.Show("请检查数据库!" + errorstring, "提醒!",
                                MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                button1.Enabled = false;
                return;
            }

            //按数据库里边存储的办事处绑定下拉列表
            errorstring = conn.BindComboBox("Select * from Office Where QuXian_ID_OfficeIn=" + comboBox_QuXian.SelectedValue.ToString(), comboBox_Office, "Office_ID", "Office_Name");
            if (errorstring != "OK")
            {
                MessageBox.Show("请检查数据库!" + errorstring, "提醒!",
                                MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                button1.Enabled = false;
                return;
            }
            //按区县办事处内联显示名称,绑定DataGrid显示
            str_Sql = "SELECT Committee_ID AS 居委会代码,Committee_Name AS 居委会名称,Office_Name AS 办事处名称,QuXian_Name AS 区县名称 FROM View_Committee";

            conn.Fill(str_Sql);
            DataGrid1.SetDataBinding(conn.ds, "TableIn");

            textBox_Committee_ID.Text = conn.GetMaxId("Committee_ID", "Committee");
            //
            // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
            //
        }
Esempio n. 23
0
        public StatisticsSchool()
        {
            //
            // Windows 窗体设计器支持所必需的
            //
            InitializeComponent();

            /*
             * Count(*) AS CountHowmany
             * [0]["CountHowmany"].ToString();
             *
             *
             * string str_Sql="Select * from School";
             * string errorstring=conn.Fill(str_Sql);
             * label_SchoolCount.Text=conn.ds.Tables[0].Rows.Count.ToString();*/

            string str_Sql     = "Select Count(*) AS CountHowmany from School";
            string errorstring = conn.Fill(str_Sql);

            label_SchoolCount.Text = conn.ds.Tables[0].Rows[0]["CountHowmany"].ToString();

            //conn.BindComboBox("Select * FROM QuXian WHERE QuXian_ID<>9",comboBox_QuXian,"QuXian_Code","QuXian_Name");

            //conn.ds.Clear();
            //str_Sql="select School_Type_Name AS 学校类型,Count(School_ID) AS 个数 From View_School Group By School_Type_Name WHERE School_ID LIKE '4101"+comboBox_QuXian.SelectedValue.ToString()+"%'";
            str_Sql     = "select * FROM View_City_School_Statistics";
            errorstring = conn.Fill(str_Sql);
            DataGrid1.SetDataBinding(conn.ds, "TableIn");

            DataGridTableStyle MyStyle = new DataGridTableStyle();

            MyStyle.MappingName = "TableIn";
            DataGrid1.TableStyles.Add(MyStyle);
            //
            // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
            //
        }
Esempio n. 24
0
        public NonlegalData()
        {
            //
            // Windows 窗体设计器支持所必需的
            //
            InitializeComponent();

            string str_Sql     = "Select  School_ID AS 学校代码,School_Name AS 学校名称,Class_Type_Name AS 班级类别,Class_Name AS 班级名 FROM View_ClassSchool inner join Class_Type on View_ClassSchool.Class_Type_ID=Class_Type.Class_Type_ID WHERE (View_ClassSchool.School_Type_ID=0 AND(View_ClassSchool.Class_Type_ID>5 OR View_ClassSchool.Class_Type_ID<0)) OR (View_ClassSchool.School_Type_ID=1 AND(View_ClassSchool.Class_Type_ID<6 OR View_ClassSchool.Class_Type_ID>8)) OR (View_ClassSchool.School_Type_ID=2 AND(View_ClassSchool.Class_Type_ID<9 OR View_ClassSchool.Class_Type_ID>11)) OR (View_ClassSchool.School_Type_ID=3 AND(View_ClassSchool.Class_Type_ID<12 OR View_ClassSchool.Class_Type_ID>17)) OR (View_ClassSchool.School_Type_ID=4 AND(View_ClassSchool.Class_Type_ID<18 OR View_ClassSchool.Class_Type_ID>26)) OR (View_ClassSchool.School_Type_ID=5 AND(View_ClassSchool.Class_Type_ID<30 OR View_ClassSchool.Class_Type_ID>32)) OR (View_ClassSchool.School_Type_ID=6 AND(View_ClassSchool.Class_Type_ID<33 OR View_ClassSchool.Class_Type_ID>44))";
            string errorstring = conn.Fill(str_Sql);

            DataGrid1.SetDataBinding(conn.ds, "TableIn");

            //
            // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
            //
        }
Esempio n. 25
0
        public BrowseTeacher()
        {
            //
            // Windows 窗体设计器支持所必需的
            //
            InitializeComponent();

            conn.BindComboBox("SELECT QuXian_Code,QuXian_Name FROM QuXian", comboBox_QuXian, "QuXian_Code", "QuXian_Name");
            conn.BindComboBox("SELECT School_Type_ID,School_Type_Name FROM School_Type", comboBox_School_Type, "School_Type_ID", "School_Type_Name");

            //绑定DataGrid显示
            string str_Sql, errorstring;

            str_Sql     = "SELECT View_Class.Class_ID AS 班级代码,View_Class.Class_Type_Name AS 班级类别,View_Class.Class_Name AS 班级名,View_Class.TeacherInCharge AS 班主任 FROM View_Class";
            errorstring = conn.Fill(str_Sql);
            if (errorstring != "OK")
            {
                MessageBox.Show("请检查数据库!" + errorstring, "提醒!",
                                MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                button1.Enabled = false;
                return;
            }
            str_Sql = "Select * from School";
            if (conn.GetRowCount(str_Sql) == 0)
            {
                MessageBox.Show("请先输入学校信息!", "警告!",
                                MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                button1.Enabled = false;
                return;
            }

            conn.BindComboBox("Select * FROM School WHERE School_Type_ID=" + comboBox_School_Type.SelectedValue + " AND School_ID Like '____" + comboBox_QuXian.SelectedValue + "%' Order By School_Type_ID,School_ID", comboBox_School, "School_ID", "School_Name");

            str_Sql = "SELECT Teacher_ID As 身份证号码,Name As 姓名,Sex AS 性别,convert(char(10),Birthday,120) As 出生日期,convert(char(10),WorkTime,120) As 参加工作时间,SchoolType AS 学历,PostCan AS 职称,PostIn AS 职务,SchoolGrad AS 毕业院校,convert(char(10),GradTime,120)  毕业日期,SpecialIn AS 所学专业,InWorkSheet As 在编,IsFullTime AS 专任教师,LessonTeach AS 担任课程 FROM Teacher WHERE School_ID='000'";
            conn.Fill(str_Sql);
            DataGrid1.SetDataBinding(conn.ds, "TableIn");

            DataGridTableStyle MyStyle = new DataGridTableStyle();

            MyStyle.MappingName = "TableIn";
            DataGrid1.TableStyles.Add(MyStyle);
            MyStyle.GridColumnStyles["身份证号码"].Width = 120;
            MyStyle.GridColumnStyles["性别"].Width    = 30;
            MyStyle.GridColumnStyles["在编"].Width    = 30;
            MyStyle.GridColumnStyles["专任教师"].Width  = 60;
            //
            // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
            //
        }
Esempio n. 26
0
        private void button1_Click(object sender, System.EventArgs e)
        {
            config connFirst = new config();
            //测试数据库连接
            string str_Sql     = "SELECT School_Type_ID As 学校类别代码,School_Type_Name As 学校类别名,School_Type_Year As 学校类别学制 FROM School_Type";
            string errorstring = connFirst.Fill(str_Sql);

            if (errorstring != "OK")
            {
                MessageBox.Show("请检查数据库!" + errorstring, "提醒!",
                                MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                connFirst.Close();
                return;
            }

            //特殊字符不能用
            if (connFirst.Sniffer_In(textBox_User.Text) || connFirst.Sniffer_In(textBox_PassWord.Text))
            {
                MessageBox.Show("用户名或密码不得用空格或者'\"?%=等特殊字符!" + errorstring, "提醒!",
                                MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                connFirst.Close();
                return;
            }

            //判断用户合法
            str_Sql = "Select * FROM Users WHERE UserName= '******' AND PassWord='******'";
            if (connFirst.GetRowCount(str_Sql) != 1)
            {
                MessageBox.Show("错误的用户名或密码!" + errorstring, "提醒!",
                                MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                connFirst.Close();

                button1.Enabled = true;
                return;
            }
            else
            {
                str_User_login = textBox_User.Text;
                this.Close();
            }
        }
Esempio n. 27
0
        public BrowseClass()
        {
            //
            // Windows 窗体设计器支持所必需的
            //
            InitializeComponent();

            conn.BindComboBox("SELECT QuXian_Code,QuXian_Name FROM QuXian", comboBox_QuXian, "QuXian_Code", "QuXian_Name");
            conn.BindComboBox("SELECT School_Type_ID,School_Type_Name FROM School_Type", comboBox_School_Type, "School_Type_ID", "School_Type_Name");

            //绑定DataGrid显示
            string str_Sql, errorstring;

            str_Sql     = "SELECT View_Class.Class_ID AS 班级代码,View_Class.Class_Type_Name AS 班级类别,View_Class.Class_Name AS 班级名,View_Class.TeacherInCharge AS 班主任,Student_Count AS 学生人数 FROM View_Class";
            errorstring = conn.Fill(str_Sql);
            if (errorstring != "OK")
            {
                MessageBox.Show("请检查数据库!" + errorstring, "提醒!",
                                MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                button1.Enabled = false;
                return;
            }

            str_Sql = "Select * from School";
            if (conn.GetRowCount(str_Sql) == 0)
            {
                MessageBox.Show("请先输入学校信息!", "警告!",
                                MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                button1.Enabled = false;
                return;
            }
            conn.BindComboBox("Select * FROM School WHERE School_Type_ID=" + comboBox_School_Type.SelectedValue + " AND School_ID Like '____" + comboBox_QuXian.SelectedValue + "%' Order By School_Type_ID,School_ID", comboBox_School, "School_ID", "School_Name");

            if (comboBox_School.Items.Count != 0)
            {
                str_Sql     = "SELECT View_Class.Class_ID AS 班级代码,View_Class.Class_Type_Name AS 班级类别,View_Class.Class_Name AS 班级名,View_Class.TeacherInCharge AS 班主任,Student_Count AS 学生人数 FROM View_Class WHERE View_Class.School_ID='" + comboBox_School.SelectedValue.ToString() + "'";
                errorstring = conn.Fill(str_Sql);
                DataGrid1.SetDataBinding(conn.ds, "TableIn");
            }
            //
            // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
            //
        }
        public StatisticsTeacher()
        {
            //
            // Windows 窗体设计器支持所必需的
            //
            InitializeComponent();

            string str_Sql = "Select * from School";

            if (conn.GetRowCount(str_Sql) == 0)
            {
                MessageBox.Show("请先输入学校信息!", "警告!",
                                MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                button1.Enabled = false;
                return;
            }

            conn.BindComboBox("SELECT QuXian_Code,QuXian_Name FROM QuXian", comboBox_QuXian, "QuXian_Code", "QuXian_Name");
            conn.BindComboBox("SELECT School_Type_ID,School_Type_Name FROM School_Type", comboBox_School_Type, "School_Type_ID", "School_Type_Name");

            conn.BindComboBox("Select * FROM School Order By School_Type_ID,School_ID", comboBox_School, "School_ID", "School_Name");

            str_Sql = "Select * from View_Teacher_Statistics   WHERE View_Teacher_Statistics.学校代码='" + comboBox_School.SelectedValue.ToString() + "'";
            string errorstring = conn.Fill(str_Sql);

            DataGrid1.SetDataBinding(conn.ds, "TableIn");

            DataGridTableStyle MyStyle = new DataGridTableStyle();

            MyStyle.MappingName = "TableIn";
            DataGrid1.TableStyles.Add(MyStyle);
            MyStyle.GridColumnStyles["学校代码"].Width = 90;
            MyStyle.GridColumnStyles["学校名称"].Width = 200;
            //
            // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
            //
        }
Esempio n. 29
0
        private void button1_Click(object sender, System.EventArgs e)
        {
            if (checkBox_First.Checked == true)
            {
                try
                {
                    string      path = "SchoolManage.exe.config";
                    XmlDocument xd   = new XmlDocument();
                    xd.Load(path);
                    //判断节点是否存在,如果存在则修改当前节点
                    foreach (XmlNode xn1 in xd.SelectNodes("/configuration/appSettings/add"))
                    {
                        if (xn1.Attributes["key"].Value == "Database")
                        {
                            xn1.Attributes["value"].Value = textBox_Database.Text;
                            //break;
                        }
                        if (xn1.Attributes["key"].Value == "DatabaseServer")
                        {
                            xn1.Attributes["value"].Value = textBox_DBServer.Text;
                            //break;
                        }
                        if (xn1.Attributes["key"].Value == "DatabaseUser")
                        {
                            xn1.Attributes["value"].Value = textBox_DbUser.Text;
                            break;
                        }

                        /*if(xn1.Attributes["key"].Value=="DatabasePassword")
                         * {
                         *      xn1.Attributes["value"].Value=textBox_DbPassWord.Text;
                         *      break;
                         * }*/
                    }
                    //保存web.config
                    xd.Save(path);
                    //return true;
                    MessageBox.Show("成功修改!", "提醒!",
                                    MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
                catch
                {
                    //return false;
                    throw new Exception("Config设置文件读取失败!");
                }
            }

            //测试数据库连接
            string str_Sql, errorstring;

            str_Sql     = "SELECT School_Type_ID As 学校类别代码,School_Type_Name As 学校类别名,School_Type_Year As 学校类别学制 FROM School_Type";
            errorstring = conn.Fill(str_Sql);
            if (errorstring != "OK")
            {
                MessageBox.Show("请检查数据库!" + errorstring, "提醒!",
                                MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                conn.Close();
                return;
            }

            //特殊字符不能用
            if (conn.Sniffer_In(textBox_User.Text) || conn.Sniffer_In(textBox_PassWord.Text))
            {
                MessageBox.Show("用户名或密码不得用空格或者'\"?%=等特殊字符!" + errorstring, "提醒!",
                                MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                conn.Close();
                return;
            }

            //判断用户合法
            str_Sql = "Select * FROM Users WHERE UserName= '******' AND PassWord='******'";
            if (conn.GetRowCount(str_Sql) != 1)
            {
                MessageBox.Show("错误的用户名或密码!" + errorstring, "提醒!",
                                MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                conn.Close();

                button1.Enabled = true;
                return;
            }
            else
            {
                str_User_login = textBox_User.Text;

                this.Close();
            }
        }
        public BrowseStudent()
        {
            //
            // Windows 窗体设计器支持所必需的
            //
            InitializeComponent();

            conn.BindComboBox("SELECT QuXian_Code,QuXian_Name FROM QuXian", comboBox_QuXian, "QuXian_Code", "QuXian_Name");
            conn.BindComboBox("SELECT School_Type_ID,School_Type_Name FROM School_Type", comboBox_School_Type, "School_Type_ID", "School_Type_Name");

            string str_Sql, errorstring;

            str_Sql = "Select * from Class";
            if (conn.GetRowCount(str_Sql) == 0)
            {
                MessageBox.Show("请先输入班级信息!", "警告!",
                                MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                button1.Enabled = false;
                return;
            }
            //绑定下拉列表显示数据库中所有的学校
            conn.BindComboBox("Select * FROM School WHERE School_Type_ID=" + comboBox_School_Type.SelectedValue + " AND School_ID Like '____" + comboBox_QuXian.SelectedValue + "%' Order By School_Type_ID,School_ID", comboBox_School, "School_ID", "School_Name");

            if (comboBox_School.Items.Count == 0)
            {
                return;
            }
            else
            {
                //根据选择的学校绑定下拉列表显示该学校对应的所有班级类型
                conn.BindComboBox("Select * FROM Class_Type WHERE School_Type_ID_Class_Belong=" + conn.School_IDtoWhat(comboBox_School.SelectedValue.ToString(), "School_Type_ID"), comboBox_Class_Type, "Class_Type_ID", "Class_Type_Name");
                //根据选择的学校和选择的班级类型绑定下拉列表显示该学校的这种班级类型对应的班级
                conn.BindComboBox("Select * FROM Class WHERE Class_Type_ID=" + comboBox_Class_Type.SelectedValue.ToString() + "AND School_ID='" + comboBox_School.SelectedValue.ToString() + "'", comboBox_Class, "Class_ID", "Class_Name");
            }

            if (comboBox_Class.Items.Count == 0)
            {
                return;
            }
            else
            {
                //绑定DataGrid显示

                DataGrid1.CaptionText = comboBox_Class_Type.Text.ToString() + "-"
                                        + comboBox_Class.Text.ToString() + "  "
                                        + "现有学生信息";

                str_Sql = "SELECT Student_ID As 身份证号码,Name As 姓名,Sex AS 性别,convert(char(10),Birthday,120) As 出生日期,Father AS 父亲,Mother AS 母亲,Keeper AS 监护人,StudentTel AS 联系电话,Student_Address AS 家庭住址,Father_Job AS 父亲职业,Father_XueLi AS 父亲学历,Mother_Job AS 母亲职业,Mother_XueLi AS 母亲学历,QuXian_Name AS 区县,Office_Name AS 办事处,Committee_Name AS 居委会 FROM View_StudentClass_Detail_City4 WHERE Class_ID=" + comboBox_Class.SelectedValue + " AND School_ID='" + comboBox_School.SelectedValue.ToString() + "'";
                conn.Fill(str_Sql);
                DataGrid1.SetDataBinding(conn.ds, "TableIn");

                DataGridTableStyle MyStyle = new DataGridTableStyle();
                MyStyle.MappingName = "TableIn";
                DataGrid1.TableStyles.Add(MyStyle);
                MyStyle.GridColumnStyles["身份证号码"].Width = 120;
                MyStyle.GridColumnStyles["性别"].Width    = 30;
                MyStyle.GridColumnStyles["家庭住址"].Width  = 200;
                MyStyle.GridColumnStyles["联系电话"].Width  = 80;
            }
            //
            // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
            //
        }