예제 #1
0
 public static void SaveItems(Items_products items_Products)
 {
     using (IDbConnection cnn = new SQLiteConnection(LoadConnectionString()))
     {
         cnn.Execute("insert into items_products (name, barcode, price, quantity) values (@name, @barcode, @price, @quantity)", items_Products);
     }
 }
예제 #2
0
 public static void UpdateDatabase(Items_products store_inventory)
 {
     using (IDbConnection cnn = new SQLiteConnection(LoadConnectionString()))
     {
         cnn.Execute("UPDATE items_products SET quantity = " + store_inventory.quantity + " WHERE id = " + store_inventory.id + ";");
     }
 }
예제 #3
0
        private void button_add_Click(object sender, EventArgs e)
        {
            Items_products product = new Items_products();

            product.name     = textBox_name.Text;
            product.barcode  = textBox_barcode.Text;
            product.price    = Double.Parse(textBox_price.Text);
            product.quantity = Int32.Parse(textBox_quantity.Text);
            AccessSQLite.SaveItems(product);
            MessageBox.Show("product added to the database");
            mainform.getFromSQLite();
        }