/// <summary> /// 添加用户蔬菜价格 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button2_Click(object sender, EventArgs e) { Price_UserDB price_UserDB = new Price_UserDB(); Price_User price_User = new Price_User(comboBox4.Text, Convert.ToDouble(textBox1.Text), Data.User.ID1); if (comboBox4.SelectedIndex == -1) { price_UserDB.add(price_User); } else { price_UserDB.Change(price_User); } MessageBox.Show("标价成功!", "提示", MessageBoxButtons.OK); }