当前位置:首页 > 数据库课设 超市管理系统
5.5 商品信息模块
界面如图5-4所示。
图5-5 商品信息界面
主要实现代码如下:
using System;
using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text;
using System.Windows.Forms;
namespace 超市系统 {
public partial class 商品 : Form
{
public 商品() {
InitializeComponent(); }
private void Bind(string sql) {
MyDataSource data = new MyDataSource(); DataSet ds = data.get_dataset(sql); dataGridView1.DataSource = ds.Tables[0]; }
private void 商品_Load(object sender, EventArgs e)
{
string sql = \; Bind(sql); }
private void button2_Click(object sender, EventArgs e) {
Form1 a = new Form1(); this.Hide();
a.ShowDialog(); }
private void button1_Click_1(object sender, EventArgs e) {
string deletedid =
dataGridView1.CurrentRow.Cells[\商品名称\].Value.ToString();
string sql = \商品名称='\ + deletedid + \;
MyDataSource data = new MyDataSource(); data.update(sql);
Bind(\); }
private void button3_Click(object sender, EventArgs e) {
string deletedid =
dataGridView1.CurrentRow.Cells[\商品名称\].Value.ToString();
string sql = \商品名称='\ + textBox1.Text + \单价='\ + textBox2.Text + \进货数量='\ + textBox3.Text + \供应商='\ + textBox4.Text + \商品类型='\ + textBox5.Text + \摆放位置='\ + textBox6.Text + \商品名称='\ + deletedid + \;
MyDataSource data = new MyDataSource(); data.update(sql);
Bind(\); }
private void button4_Click(object sender, EventArgs e) {
string sql = \into shangpin(商品名称,单价,进货数量,供应商,商品类型,摆放位
置)values('\+textBox1.Text+\+textBox2.Text+\+textBox3.Text+\+textBox4.Text+\+textBox5.Text+\+textBox6.Text+\;
MyDataSource data = new MyDataSource(); data.update(sql);
Bind(\); }
共分享92篇相关文档