Hello, I just starting using C# and I have a textbox on a form. I want to retrieve data from the acces database and display to the texbox, and then that the user modify something in the textbox and with a button Update, update the database. I have the code for conecction to acces. Maybe someone has a good example for me, thanks. I hope you can help me
this is my code
using (var conn = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=Policias.accdb"))
using (var cmd = conn.CreateCommand()) {
cmd.CommandText = "SELECT contain from section "; cmd.Parameters. conn.Open(); cmd.ExecuteNonQuery();
int rowsAffected = cmd.ExecuteNonQuery(); if (rowsAffected == 1) { MessageBox.Show("Success"); } else { MessageBox.Show(string.Format("{0} Rows Affected", rowsAffected)); } }
|