I cannot save data in access 2007. I tried the following:
- Add a password to my DB; didn't work
- Saved the db as a 2003 file; didn't work
Here is my code:
public bool ExecuteUDI(string query)
{
Command = new OleDbCommand();
Command.Connection = Connection;
Command.CommandText = query;
Command.CommandType = System.Data.CommandType.Text;
try
{
// Open connection
Open();
if (Command.ExecuteNonQuery() != -1)
return true;
else
return false;
}
catch (Exception e)
{
mError = "ExecuteUDI - " + e.Message;
return false;
}
finally
{
// Always close connection
Close();
}
}
When I add breakpoints, I see my query looks good:
INSERT INTO DVD (Titel) VALUES ('Elegy')
I don't get any errors, but the affected rows is 0. How come? I dont understand..