c# - Access DB - operation must use an updateable query -
i have table need update user's password username store in session. however, got error: "operation must use updateable query" though have granted users , administrators full control.
the following codes:
string str = @"provider=microsoft.ace.oledb.12.0;data source=c:\inetpub\wwwroot\myfolder\mydatabase"; using (oledbconnection con = new oledbconnection(str)) using (oledbcommand cmd = con.createcommand()) { cmd.commandtext = "update [users] set [password] = ? username = ?"; cmd.parameters.add("password", oledbtype.varchar).value = request.form["conpassword"]; cmd.parameters.add("username", oledbtype.varchar).value = (string)session["username"]; con.open(); try { cmd.executenonquery(); messagebox.show("your password has been changed successfully."); } catch (exception ex) { response.write(ex.message); } { con.close(); } }
Comments
Post a Comment