private void FormMembercs_Load(object sender, EventArgs e) { //显示会员信息 string memSql = "select *from Customers "; operat.DataBind(this.dataGridViewMember, memSql, "Customers"); this.InitDataGridViewHead(); SetdataGridViewNoSort(this.dataGridViewMember); }
/// <summary> /// 录入商品信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonOk_Click(object sender, EventArgs e) { try { if (textBoxId.Text != "" && textBoxName.Text != "" && textBoxBid.Text != "" && textBoxSellPrice.Text != "") { if (operat.FindIdExist("Products", "products_id", textBoxId.Text) == true) { MessageBox.Show("该商品编号已经存在,请重新添加!", "提示"); return; } else { string productor_id = this.textBoxId.Text; string vendorsname = ""; //供货商名称 string productor_name = this.textBoxName.Text; string productor_spec = this.comboBoxSpec.Text; string productor_bid = this.textBoxBid.Text; string productor_sell_price = this.textBoxSellPrice.Text; string productor_date = this.dateTimePicker1.Text; string productor_quality_date = this.comboBoxQuality.Text; vendorsname = operat.FindVendorsId("Vendors", comboBoxVen.Text); string InsertSql = "insert into Products values(" + productor_id + ",'" + vendorsname + "','" + productor_name + "','"; InsertSql += productor_spec + "','" + productor_bid + "','" + productor_sell_price + "','" + textBoxProNum.Text + "','" + productor_date + "','"; InsertSql += productor_quality_date + "')"; if (operat.OperateData(InsertSql) > 0) { operat.StoreManage(productor_id, productor_sell_price, textBoxProNum.Text); MessageBox.Show("录入商品信息成功!", "提示"); operat.DataBind(this.dataGridViewPurchase, "select *from Products", "Products"); return; } } } else { MessageBox.Show("请填满所有字段", "提示"); return; } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { //关闭数据库 operat.CloseDatabaseCnn(); } }
private void FormStatistics_Load(object sender, EventArgs e) { //销售明细表绑定 operat.DataBind(dataGridView1, "select *from SellProductsInfo", "SellProductsInfo"); //销售细节信息绑定 string sellingSql = "select products_name,sum(sealling_price) sealling_price from SellProductsInfo group by products_name"; string bidSql = "select products_name,sum(products_bid) products_bid from SellProductsInfo group by products_name"; operat.DataBind(dataGridViewName, sellingSql, "SellProductsInfo"); operat.DataBind(dataGridViewmonth, bidSql, "SellProductsInfo"); //显示自定义表头 InitDataGridViewHead(); }
private void FormSystem_Load(object sender, EventArgs e) { //供货商信息显示 string VendorsSql = "select *from vendors"; operat.DataBind(this.dataGridViewVendors, VendorsSql, "Vendors"); //用户信息绑定 string userSql = "select *from Users"; operat.DataBind(this.dataGridViewUser, userSql, "Users"); //显示单位信息 operat.DataBind(dataGridViewUnit, "select *from Products_Unit", "Products_Unit"); this.InitDataGridViewHead();//自定义标题 }