I’m trying to add data to a ms access database, it runs without errors but the database is not modified. Am I wrong or I forgot something?
//using System.Data.OleDb;
private void button2_Click(object sender, EventArgs e)
{
string conStr = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Projects\Cinema.accdb;Persist Security Info=False;";
OleDbConnection con = new OleDbConnection(conStr);
con.Open();
OleDbCommand cmd = new OleDbCommand("insert into seats(number)" + "Values(1)", con);
con.Close();
}
You have to execute your command.