0

I'm trying to enable read/write in access database protect with a password, but I read-only. I have tried this:

return "provider=microsoft.ace.oledb.12.0;" +  
       " data source=" +  
       "AppDomain.CurrentDomain.BaseDirectory" +  
       "DebtManagementSystem.accdb;" +  
       "Jet OLEDB:Database Password = muqtada!;" +  
       "User Id=admin;Persist Security Info=False;";

but it doesn't work!

the OleDbException is:

System.Data.OleDb.OleDbException (0x80004005): Operation must use an updateable query. at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr) at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) at System.Data.OleDb.OleDbCommand.ExecuteNonQuery() at DebtManagementSystem.Model.DatabaseProvider.runCommand(String query)

Steve
  • 213,761
  • 22
  • 232
  • 286
  • Please show the code that uses that string. We need it to understand the error – Steve Aug 13 '23 at 15:18
  • 1
    Does this answer your question? [Get user and password from ConnectionStringSettings](https://stackoverflow.com/questions/7900201/get-user-and-password-from-connectionstringsettings) – June7 Aug 13 '23 at 17:48
  • Also review https://stackoverflow.com/questions/61486081/password-with-special-characters-in-connectionstring – June7 Aug 13 '23 at 17:50
  • `Operation must use an updateable query` is a common error that's rarely related on how you connected to the database and if it's protected. If you share that query, we can likely help, but be sure to first check https://stackoverflow.com/q/537161 and others for potential fixes to make sure it isn't a duplicate. – Erik A Aug 14 '23 at 09:14

0 Answers0