public static void InsertMattress(mattress mattress) { using (IDbConnection cnn = new SQLiteConnection(LoadConnectionString())) { cnn.Execute("insert into mattress_lookup (mattress, feel, year, profile) values (@Mattress, @feel, @year, @profile)", mattress); } }
private void button1_Click(object sender, EventArgs e) { //insert button will create new row of data mattress m = new mattress(); m.Mattress = NameTextBox.Text; m.feel = FeelTextBox.Text; m.year = YearTextBox.Text; m.profile = ProfileTextBox.Text; DataAccess.InsertMattress(m); NameTextBox.Text = ""; FeelTextBox.Text = ""; YearTextBox.Text = ""; ProfileTextBox.Text = ""; MessageBox.Show("Record inserted successfully"); }