private void SetCombox3() { GoodsClass g = (this.comboBox中类.SelectedItem as GoodsClass); if (g == null) { return; } string s = string.Format("select bh,pm,dnm from fl where char_length(dnm)=6 and substring(dnm,1,4)='{0}' order by dnm asc", g.dnm); command.CommandText = s; MySqlDataReader dr = command.ExecuteReader(); this.comboBox小类.Items.Clear(); while (dr.Read()) { GoodsClass gc = new GoodsClass(dr.GetInt32(0), dr.GetString(1), dr.GetString(2)); this.comboBox小类.Items.Add(gc); } dr.Close(); if (this.comboBox小类.Items.Count > 0) { this.comboBox小类.SelectedIndex = 0; } }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { if (this.comboBox1.Items.Count == 0) { return; } GoodsClass g = this.comboBox1.SelectedItem as GoodsClass; command.CommandText = string.Format("select ifnull(max(bh),0)+1 from fl where char_length(dnm)=4 and substring(dnm,1,2)='{0}'", g.dnm); bh = int.Parse(command.ExecuteScalar().ToString()); this.textBox1中类.Text = g.dnm + bh.ToString("00"); this.textBox2品名.Text = g.pm; this.textBox2品名.Select(); this.textBox2品名.SelectionStart = this.textBox2品名.TextLength; }
private void comboBox小类_SelectedIndexChanged(object sender, EventArgs e) { string tm = this.textBox_tm.Text; tm = tm.Remove(0, 6); tm = (this.comboBox小类.SelectedItem as GoodsClass).dnm + tm; this.textBox_tm.Text = tm; this.textBox_jj.Select(); GoodsClass g = this.comboBox小类.SelectedItem as GoodsClass; if (g == null) { return; } this.textBox_pm.Text = g.pm; }
private void SetCombox1() { string s = "select bh,pm,dnm from fl where char_length(dnm)=2 order by dnm asc"; command.CommandText = s; MySqlDataReader dr = command.ExecuteReader(); while (dr.Read()) { GoodsClass gc = new GoodsClass(dr.GetInt32(0), dr.GetString(1), dr.GetString(2)); this.comboBox大类.Items.Add(gc); } dr.Close(); if (this.comboBox大类.Items.Count > 0) { this.comboBox大类.SelectedIndex = 0; } }
protected void AddZL_Load(object sender, EventArgs e) { //bh编号(max)、pm品名、dnm店内码(2位大类、4位中类、6位小类) command.CommandText = "select bh,pm,dnm from fl where char_length(dnm)=2 order by dnm asc"; MySqlDataReader dr = command.ExecuteReader(); while (dr.Read()) { GoodsClass gc = new GoodsClass(dr.GetInt32(0), dr.GetString(1), dr.GetString(2)); this.comboBox1.Items.Add(gc); } dr.Close(); if (this.comboBox1.Items.Count == 0) { return; } this.comboBox1.SelectedIndex = 0; }