private void FmSchool_Load(object sender, EventArgs e) { try { CbSchoolProvince.Items.Clear(); string sql1 = ""; sql1 = "select distinct schoolProvince from cardSchool"; SqlDataReader dr = db.DB_Red(sql1); if (dr.HasRows) { while (dr.Read()) { CbSchoolProvince.Items.Add(dr["schoolProvince"].ToString()); } dr.Close(); db.connClose(); } } catch { MessageBox.Show("窗口加载失败!"); } }
private void FmCard_Load(object sender, EventArgs e) { try { CbAllType.Items.Clear(); string sql1 = ""; sql1 = "select distinct QuaType from Qualifications"; SqlDataReader dr = db.DB_Red(sql1); if (dr.HasRows) { while (dr.Read()) { CbAllType.Items.Add(dr["QuaType"].ToString()); } dr.Close(); db.connClose(); } } catch { MessageBox.Show("窗口加载失败"); } }
private void button2_Click(object sender, EventArgs e) { strID = tbID.Text.Trim(); strPsd = tbPsd.Text.Trim(); strPsd1 = tbPsd1.Text.Trim(); strUserName = tbUserName.Text.Trim(); if (radioButton1.Checked == true) { strSex = radioButton1.Text; } else if (radioButton2.Checked == true) { strSex = radioButton2.Text; } strShenFen = comboBox1.Text; strXueLi = comboBox2.Text; strPhone = tbPhone.Text.Trim(); strArea1 = comboBox3.Text; strArea2 = comboBox4.Text; strArea3 = comboBox5.Text; if (strID == "" || strPsd == "" || strPsd1 == "" || strUserName == "" || strSex == "" || strShenFen == "" || strXueLi == "" || strPhone == "" || strArea1 == "" || strArea2 == "" || strArea3 == "") { MessageBox.Show("注册内容不能为空"); return; } if (strPsd != strPsd1) { MessageBox.Show("两次输入的密码不一样"); return; } string strSql = ""; strSql = "insert into userTable values('" + strID + "','" + strPsd + "','" + strUserName + "','" + strSex + "','" + strShenFen + "','" + strXueLi + "','" + strPhone + "','" + strArea1 + "','" + strArea2 + "','" + strArea3 + "')"; try { db.DB_ZSG(strSql); db.connClose(); MessageBox.Show("注册成功"); this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void FmIdUp_Load(object sender, EventArgs e) { try { DBCL.DataBase db = new DBCL.DataBase(); string sql = "select * from userTable where userID = '" + username + "'"; textBox1.Text = db.DB_C(sql, 2); comboBox2.Text = db.DB_C(sql, 5); db.odrClose(); db.connClose(); } catch { MessageBox.Show("窗口加载失败"); } }
public FmIdUp() { try { DBCL.DataBase db = new DBCL.DataBase(); string strSql = ""; strSql = "select * from Users"; username = db.DB_C(strSql, 0); db.odrClose(); db.connClose(); } catch { MessageBox.Show("窗口初始化失败"); } InitializeComponent(); }
private void FmLessonShow_Load(object sender, EventArgs e) { string type = Gloable.type; try { string sql1 = ""; sql1 = "select QuaName from Qualifications where QuaType = '" + type + "'"; SqlDataReader dr = db.DB_Red(sql1); if (dr.HasRows) { while (dr.Read()) { CbQuaName.Items.Add(dr["QuaName"].ToString()); } dr.Close(); db.connClose(); } } catch { MessageBox.Show("窗口加载失败"); } }
private void button2_Click(object sender, EventArgs e) { try { DBCL.DataBase db = new DBCL.DataBase(); string name = ""; string sex = ""; string diploma = ""; string cardclass = ""; string card = ""; string school = ""; string idnum = ""; string tel = ""; string tel1 = ""; string tel2 = ""; string phone = ""; string province = ""; string city = ""; string area = ""; string note = ""; name = textBox1.Text; if (radioButton1.Checked == true) { sex = radioButton1.Text; } else if (radioButton2.Checked == false) { sex = radioButton2.Text; } diploma = comboBox2.Text; cardclass = comboBox8.Text; card = comboBox7.Text; school = comboBox1.Text; idnum = textBox7.Text.Trim(); tel1 = textBox6.Text.Trim(); tel2 = textBox3.Text.Trim(); tel = tel1 + tel2; phone = textBox4.Text.Trim(); province = comboBox3.Text; city = comboBox4.Text; area = comboBox5.Text; note = textBox2.Text.Trim(); if (sex == "" || cardclass == "" || card == "" || idnum == "" || phone == "" || province == "" || city == "" || area == "" || note == "") { MessageBox.Show("提交内容不能为空"); return; } string sql1 = ""; //sql1 = "insert into Users values('5')"; sql1 = "insert into signUp values('" + username + "','" + name + "','" + sex + "','" + diploma + "','" + cardclass + "','" + card + "','" + school + "','" + idnum + "','" + tel + "','" + phone + "','" + province + "','" + city + "','" + area + "','" + note + "')"; db.DB_ZSG(sql1); db.connClose(); MessageBox.Show("提交成功"); } catch { MessageBox.Show("信息提交异常"); } }