private void button1_Click(object sender, EventArgs e) { if (!CheckTM()) { return; } if (!CheckPM()) { return; } if (!CheckJJ()) { return; } if (!CheckSJ()) { return; } if (!CheckPTZQ()) { return; } if (!CheckHYZQ()) { return; } if (!CheckGHS()) { return; } string str = string.Format("insert into {0}(tm,pm,jj,sj,zq,hyzq,ghs) values(", db); str += "'" + this.textBox_tm.Text.Trim() + "',"; //tm str += "'" + this.textBox_pm.Text.Trim() + "',"; //pm str += this.textBox_jj.Text.Trim() + ","; //jj str += this.textBox_sj.Text.Trim() + ","; //sj str += this.textBox_ptzq.Text.Trim() + ","; //ptzq; str += this.textBox_hyzq.Text.Trim() + ",'"; //hyzq Ghs ghs = this.textBox_ghs.SelectedItem as Ghs; str += ghs.bh + "')";//ghs command.CommandText = str; try { command.ExecuteNonQuery(); } catch (MySqlException se) { MessageBox.Show("新增商品时发生错误,检查输入数据是否正确\r\n" + se.Message, "出错"); } //this.textBox_tm.Clear(); //this.textBox_pm.Clear(); this.textBox_jj.Clear(); this.textBox_sj.Clear(); this.textBox_jj.Select(); }
public Form_goods_edit() { InitializeComponent(); command = Form_main.Command; Ghs zm = new Ghs("1001", "专卖"); Ghs zy = new Ghs("1002", "自营"); this.comboBox_ghs.Items.AddRange(new Ghs[] { zm, zy }); this.comboBox_ghs.SelectedIndex = 0; }
public Form_NewGoods(string db) { InitializeComponent(); this.db = db; this.textBox_ptzq.Text = "1.0"; this.textBox_hyzq.Text = "1.0"; command = Form_main.Command; // Ghs zm = new Ghs("1001", "专卖"); Ghs zy = new Ghs("1001", "自营"); this.textBox_ghs.Items.AddRange(new Ghs[] { zy }); this.textBox_ghs.SelectedIndex = 0; }
public Form_NewGoods(string db) { InitializeComponent(); this.db = db; this.textBox_ptzq.Text = "1.0"; this.textBox_hyzq.Text = "1.0"; connection = Form_main.Connection; command = new MySqlCommand(); command.Connection = connection; // Ghs zm = new Ghs("1001", "专卖"); Ghs zy = new Ghs("1001", "自营"); this.textBox_ghs.Items.AddRange(new Ghs[] { zy }); this.textBox_ghs.SelectedIndex = 0; this.Icon = Properties.Resources.yuan; }