public static void SavePayment(string TableName, PaymentClass P) { using (IDbConnection cnn = new SQLiteConnection(LoadConnectionString())) { _ = cnn.Execute("insert into Payment values (@ID, @Amount, @Username)", P); } }
private void payButton_Click(object sender, EventArgs e) { PaymentClass P = new PaymentClass { Amount = Convert.ToString(B[0].Payment(B)), Username = U.Username }; List <PaymentClass> Plist = new List <PaymentClass>(); Plist = ShopDatabase.GetPayment("Payment"); if (Plist.Count == 0) { P.ID = 1; ShopDatabase.SavePayment("Payment", P); } else { P.ID = Plist[Plist.Count - 1].ID + 1; ShopDatabase.SavePayment("Payment", P); } MessageBox.Show("works"); }