public ModifySchool_ID() { // // 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 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) { textBox_Old_School_ID.Text = comboBox_School.SelectedValue.ToString(); } // // 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 调用后添加任何构造函数代码 // }
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 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 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 调用后添加任何构造函数代码 // }
public DeleteManyOld() { // // 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"); // // TODO: 在 InitializeComponent 调用后添加任何构造函数代码 // }
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 调用后添加任何构造函数代码 // }
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 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 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 调用后添加任何构造函数代码 // }
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 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 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 QuXianDataOut() { // // Windows 窗体设计器支持所必需的 // InitializeComponent(); conn.BindComboBox("SELECT QuXian_Code,QuXian_Name FROM QuXian", comboBox_QuXian, "QuXian_Code", "QuXian_Name"); // // TODO: 在 InitializeComponent 调用后添加任何构造函数代码 // }
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 调用后添加任何构造函数代码 // }
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 调用后添加任何构造函数代码 // }
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 调用后添加任何构造函数代码 // }
public QuXian_Office_Committee() { // // Windows 窗体设计器支持所必需的 // InitializeComponent(); //绑定下拉列表显示区县 string str_Sql, errorstring; button1.Enabled = false; 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); button_QuXian.Enabled = false; button_Office.Enabled = false; button_Committee.Enabled = false; return; } conn.BindComboBox("Select * from Office WHERE QuXian_ID_OfficeIn=" + comboBox_QuXian.SelectedValue.ToString(), comboBox_Office, "Office_ID", "Office_Name"); if (comboBox_Office.Items.Count == 0) { conn.BindComboBox("Select * from Office WHERE Office_ID=0", comboBox_Office, "Office_ID", "Office_Name"); } conn.BindComboBox("Select * from Committee WHERE Office_ID=" + comboBox_Office.SelectedValue.ToString(), comboBox_Committee, "Committee_ID", "Committee_Name"); if (comboBox_Committee.Items.Count == 0) { conn.BindComboBox("Select * from Committee WHERE Committee_ID=0", comboBox_Committee, "Committee_ID", "Committee_Name"); } // // TODO: 在 InitializeComponent 调用后添加任何构造函数代码 // }
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 调用后添加任何构造函数代码 // }