//添加 private void button1_Click(object sender, EventArgs e) { SuperMarketDataClassesDataContext db = new SuperMarketDataClassesDataContext(); SISM_commodityclass scc = new SISM_commodityclass(); if (textBox4.Text != "") { scc.SId = int.Parse(textBox4.Text); scc.SName = textBox2.Text; scc.SNote = textBox3.Text; db.SISM_commodityclass.InsertOnSubmit(scc); try { db.SubmitChanges(); dataGridView1.DataSource = db.SISM_commodityclass; MessageBox.Show("添加成功!"); clear(); } catch (Exception ex) { } } else { MessageBox.Show("请输入添加信息!"); } }
partial void UpdateSISM_commodityclass(SISM_commodityclass instance);
partial void DeleteSISM_commodityclass(SISM_commodityclass instance);
partial void InsertSISM_commodityclass(SISM_commodityclass instance);