private void button2_Click(object sender, EventArgs e) { if (num == textBox1.Text) { SFact sFact = new SFact(); string name = textBox2.Text; string sex = textBox3.Text; string age = textBox4.Text; string money = textBox5.Text; string pwd = textBox6.Text; string phone = textBox7.Text; SOperate s = sFact.Update(); s._Update("vip", "vip_name = '" + name + "',vip_sex= '" + sex + "',vip_age=" + age + ",vip_money= '" + money + "',vip_pwd='" + pwd + "',vip_phone='" + phone + "'", "id", id); } else { MessageBox.Show("会员号不可更改"); } }
private void button1_Click(object sender, EventArgs e) { DataSet ds = new DataSet(); SFact sFact = new SFact(); SOperate s = sFact.Select(); SOperate s1 = sFact.Update(); SOperate s2 = sFact.Delete(); int num = int.Parse(s._Select("good_sum", "good", "good_id", comboBox1.Text).Tables[0].Rows[0][0].ToString().Trim()); if (num < int.Parse(textBox1.Text)) { MessageBox.Show("数量不足!"); } else if (num == int.Parse(textBox1.Text)) { num = num - int.Parse(textBox1.Text); s2._Del("good", "good_id", comboBox1.Text); } else { num = num - int.Parse(textBox1.Text); s1._Update("good", "good_sum", num.ToString(), "good_id", comboBox1.Text); } }