private void button1_Click(object sender, EventArgs e) { string name = textBox3.Text.Trim(); comtext = "select * from [Wage] where name='" + name + "'"; if (sqlhelper.findname(comtext)) { ds = sqlhelper.GetDataSet(comtext, "Wage"); bindingSource1.DataSource = ds; bindingSource1.DataMember = "Wage"; textBox2.DataBindings.Add("Text", bindingSource1, "rixin"); textBox1.DataBindings.Add("Text", bindingSource1, "benxin"); textBox4.DataBindings.Add("Text", bindingSource1, "jiangjin"); textBox5.DataBindings.Add("Text", bindingSource1, "jiari"); textBox6.DataBindings.Add("Text", bindingSource1, "quanqin"); textBox7.DataBindings.Add("Text", bindingSource1, "jiaban"); textBox8.DataBindings.Add("Text", bindingSource1, "benqi"); textBox9.DataBindings.Add("Text", bindingSource1, "fuli"); textBox10.DataBindings.Add("Text", bindingSource1, "huoshi"); textBox11.DataBindings.Add("Text", bindingSource1, "suode"); textBox12.DataBindings.Add("Text", bindingSource1, "jiezhi"); textBox13.DataBindings.Add("Text", bindingSource1, "shifa"); MessageBox.Show("请在方框内输入要更改的信息!"); } else { MessageBox.Show("请检查员工姓名是否存在!"); textBox3.Text = ""; } }
private void button1_Click(object sender, EventArgs e) { comtext = "select * from [Wage] where name='" + textBox3.Text.Trim() + "'"; if (sqlhelper.findname(comtext)) { ds = sqlhelper.GetDataSet(comtext, "Wage"); label1.Text = ds.Tables[0].Rows[0][3].ToString();//将表中的第一行第四列的数据显示在label上 label2.Text = ds.Tables[0].Rows[0][4].ToString(); label3.Text = ds.Tables[0].Rows[0][5].ToString(); label4.Text = ds.Tables[0].Rows[0][6].ToString(); label5.Text = ds.Tables[0].Rows[0][7].ToString(); label6.Text = ds.Tables[0].Rows[0][8].ToString(); label7.Text = ds.Tables[0].Rows[0][9].ToString(); label18.Text = ds.Tables[0].Rows[0][10].ToString(); label33.Text = ds.Tables[0].Rows[0][11].ToString(); label35.Text = ds.Tables[0].Rows[0][12].ToString(); label36.Text = ds.Tables[0].Rows[0][13].ToString(); label37.Text = ds.Tables[0].Rows[0][14].ToString(); } else { MessageBox.Show("请检查员工姓名是否存在!"); textBox3.Text = ""; } }
private void Personwage_Load(object sender, EventArgs e) { string name = Land.name; comtext = "select * from [Wage] where name='" + name + "' "; if (sqlhelper.findname(comtext)) { ds = sqlhelper.GetDataSet(comtext, "Wage"); label1.Text = ds.Tables[0].Rows[0][3].ToString();//将表中的第一行第四列的数据显示在label上 label2.Text = ds.Tables[0].Rows[0][4].ToString(); label3.Text = ds.Tables[0].Rows[0][5].ToString(); label4.Text = ds.Tables[0].Rows[0][6].ToString(); label5.Text = ds.Tables[0].Rows[0][7].ToString(); label6.Text = ds.Tables[0].Rows[0][8].ToString(); label7.Text = ds.Tables[0].Rows[0][9].ToString(); label18.Text = ds.Tables[0].Rows[0][10].ToString(); label33.Text = ds.Tables[0].Rows[0][11].ToString(); label35.Text = ds.Tables[0].Rows[0][12].ToString(); label36.Text = ds.Tables[0].Rows[0][13].ToString(); label37.Text = ds.Tables[0].Rows[0][14].ToString(); } else { MessageBox.Show("请检查员工姓名是否存在!"); } }
private void button2_Click(object sender, EventArgs e) { string name = textBox25.Text.Trim(); comtext = "select * from [Employee] where name='" + name + "'"; if (sqlhelper.findname(comtext)) { ds = sqlhelper.GetDataSet(comtext, "Employee"); bindingSource1.DataSource = ds; bindingSource1.DataMember = "Employee"; textBox1.DataBindings.Add("Text", bindingSource1, "id"); textBox2.DataBindings.Add("Text", bindingSource1, "name"); textBox3.DataBindings.Add("Text", bindingSource1, "ename"); comboBox1.DataBindings.Add("Text", bindingSource1, "age"); comboBox2.DataBindings.Add("Text", bindingSource1, "sex"); textBox4.DataBindings.Add("Text", bindingSource1, "chusheng"); textBox5.DataBindings.Add("Text", bindingSource1, "jiguan"); textBox6.DataBindings.Add("Text", bindingSource1, "xianzhi"); textBox7.DataBindings.Add("Text", bindingSource1, "tel"); textBox8.DataBindings.Add("Text", bindingSource1, "hander"); // textBox9.DataBindings.Add("Text", bindingSource1, "jingongsi"); textBox10.DataBindings.Add("Text", bindingSource1, "zhengshi"); textBox11.DataBindings.Add("Text", bindingSource1, "hetong"); textBox12.DataBindings.Add("Text", bindingSource1, "qixian"); //textBox13.DataBindings.Add("Text", bindingSource1, "youxiaoqi"); textBox14.DataBindings.Add("Text", bindingSource1, "zhiwei"); textBox15.DataBindings.Add("Text", bindingSource1, "suoshu"); textBox16.DataBindings.Add("Text", bindingSource1, "kong"); textBox17.DataBindings.Add("Text", bindingSource1, "email"); textBox18.DataBindings.Add("Text", bindingSource1, "xueli"); textBox19.DataBindings.Add("Text", bindingSource1, "school"); textBox20.DataBindings.Add("Text", bindingSource1, "zhuanye"); textBox21.DataBindings.Add("Text", bindingSource1, "mianmao"); textBox22.DataBindings.Add("Text", bindingSource1, "hun"); textBox23.DataBindings.Add("Text", bindingSource1, "work"); textBox24.DataBindings.Add("Text", bindingSource1, "uj"); MessageBox.Show("请在方框内输入要更改的信息!"); } else { MessageBox.Show("请检查员工姓名是否存在!"); textBox25.Text = ""; } }