0

Database properties

Database

The program doesn't throw any errors, but when I check my database's table it is empty.

ProductTable productTable = new ProductTable();
TilerQuoteDataBaseEntities entities = new TilerQuoteDataBaseEntities();

public void addButtonClick(object sender, RoutedEventArgs e)
{
    int _price = int.Parse(addPriceTextBox.Text.Trim());

    try
    {
        ProductTable table = new ProductTable()
            {
                name = addProductTextBox.Text.Trim(),
                price = _price
            };

        entities.ProductTables.Add(table);
        entities.SaveChanges();

        MessageBox.Show("Success!");
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.ToString());
    }
}
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459

0 Answers0