在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
//第一步 根据DataContext中的表AdminData创建一个新实例 private InspectionAdminDataContext InspectionData = new InspectionAdminDataContext(); AdminData adminData = new AdminData { date = dateEdit1.DateTime.Date, unit = comboBoxEdit1.Text, item = comboBoxEdit2.Text, itemcontent = comboBoxEdit3.Text, problem = comboBoxEdit4.Text, detail = memoEdit1.Text, person = textEdit2.Text, deal = memoEdit2.Text }; //第二步 向表的InsertOnSubmit添加该实例 InspectionData.AdminData.InsertOnSubmit(adminData); //第三步 DataContext提交变化SubmitChanges try { InspectionData.SubmitChanges(); MessageBox.Show("数据已添加。", "通知", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception exception) { MessageBox.Show("There is an Error", "Error",MessageBoxButtons.OK, MessageBoxIcon.Error); }
|
请发表评论