Making a CRUD for an scholar library, while I can upload info I can't delete
Working with an ms Access .mdb
Tried this, which is similar to the one I use for looking for reading and showing info from the DB
string consulta;
OleDbConnection conexion;
OleDbDataAdapter adaptador;
DataSet ds = new DataSet();
conexion = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Leona.mdb");
consulta = "Delete from Libros where id=" + textBox4.Text;
adaptador = new OleDbDataAdapter(consulta, conexion);
adaptador.Fill(ds, "Libros");
dataGridView2.DataSource = ds.Tables["Libros"];
Shows no error and deletes the book from the DataGridView but not from the DB, so I tried with ExecuteNonQuery which I used to add info to the DB and works
string t = "Delete from Libros where id=" + textBox4.Text;
OleDbConnection conn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Leona.mdb");
OleDbCommand cmd = new OleDbCommand(t, conn);
conn.Open();
cmd.CommandText = t;
cmd.ExecuteNonQuery();
conn.Close();
Both output the same result, they delete from the app but the DB remains intact.