private void InsertItemToBar() { var matchedResults = (from m in _db.GetTable<items_table>() where m.item_id == textBoxItemName.Text select m).SingleOrDefault(); if (matchedResults != null) { MessageBox.Show("The same name was found in the list items! Please choose another one!"); } else { Table<items_table> itemsTable = _db.GetTable<items_table>(); items_table itemsT = new items_table(); itemsT.item_id = textBoxItemName.Text; itemsT.cost = (int) numericUpDownCost.Value; itemsT.item_description = richTextBoxDescription.Text; itemsT.category_name = comboBoxCategory.Text; itemsTable.InsertOnSubmit(itemsT); try { _db.SubmitChanges(); } catch (Exception) { MessageBox.Show("Can't update database during inserting new item"); } } Close(); }
partial void Updateitems_table(items_table instance);
partial void Deleteitems_table(items_table instance);
partial void Insertitems_table(items_table instance);