Friday, September 2, 2016

LINQ Insert

 using (POHDataContext pos = new POHDataContext())
                {
                    ProductTable newProduct = new ProductTable
                    {
                        ProductName = txtProductName.Text,
                        ProductPrice = decimal.Parse(txtProductPrice.Text),
                        Stock = int.Parse(txtStock.Text)
                    };
                    pos.ProductTables.InsertOnSubmit(newProduct);
                    pos.SubmitChanges();
                }
                GetProducts();


No comments:

Post a Comment