Hello everyone
I have searched, but nothing happens, I just starting using C#.NET and I a have a textbox on a form. I retrieve some data from the database and I display to a textbox through a combobox that indicate the section I want to display (I already do this!),but when I try to update nothing works, I click my button to update the access database(Access 2007) and nothing happens, the user just changes something and the button has to update the acces database, I hope you can help me :D this is my code so far:
String textTobeUpdated = textBox3.Text;
String thing = comboBox2.Text;
using (var conn = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=MyDataBase.accdb"))
using (var cmd = conn.CreateCommand())
{
cmd.CommandText = "UPDATE Section SET content = [@content] WHERE name= thing";
cmd.Parameters.AddWithValue("@content",content);
conn.Open();
int rowsAffected = cmd.ExecuteNonQuery();
if (rowsAffected == 1)
{
MessageBox.Show("Success");
}
else
{
MessageBox.Show(string.Format("{0} Rows Affected", rowsAffected));
}
this code display a message that tells "Unhandled exception. If click in continue, the application will omit this error and intent continue. If click in exit, the application will close immediately" The are no especified value for some of the required parameters.