//添加
        private void button1_Click(object sender, EventArgs e)
        {
            SuperMarketDataClassesDataContext db = new SuperMarketDataClassesDataContext();
            SIMS_commodity sc = new SIMS_commodity();

            if (textBox7.Text != "")
            {
                sc.CId        = int.Parse(textBox7.Text);
                sc.CName      = textBox1.Text;
                sc.CBuyPrice  = textBox2.Text;
                sc.CSalePrice = textBox3.Text;
                sc.CQty       = textBox4.Text;
                sc.CNote      = textBox5.Text;
                sc.CPicture   = sPicture;
                sc.CType      = comboBox1.Text;

                db.SIMS_commodity.InsertOnSubmit(sc);
                try
                {
                    db.SubmitChanges();
                    dataGridView1.DataSource = db.SIMS_commodity;
                    MessageBox.Show("添加成功!");
                    clear();
                }
                catch (Exception ex)
                {
                }
            }
            else
            {
                MessageBox.Show("请输入添加信息!");
            }
        }
示例#2
0
 partial void UpdateSIMS_commodity(SIMS_commodity instance);
示例#3
0
 partial void DeleteSIMS_commodity(SIMS_commodity instance);
示例#4
0
 partial void InsertSIMS_commodity(SIMS_commodity instance);