Operation must use updatable query
Hi gurus,
Please explain me about it and tell me how to correct
Code:
Server Error in '/DetailUsageViewer' Application.
Operation must use an updateable query.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.OleDb.OleDbException: Operation must use an updateable query.
Source Error:
Line 18: com.CommandType = CommandType.Text;
Line 19: con.Open();
Line 20: com.ExecuteNonQuery();
Line 21: con.Close();
Line 22: label.InnerText="OK";
Source File: d:\inetpub\wwwroot\DetailUsageViewer\testasp1.aspx Line: 20
Stack Trace:
[OleDbException (0x80004005): Operation must use an updateable query.]
System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr) +41
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) +174
System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) +92
System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) +65
System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) +112
System.Data.OleDb.OleDbCommand.ExecuteNonQuery() +67
ASP.TestAsp1_aspx.Page_Load(Object sender, EventArgs arg) in d:\inetpub\wwwroot\DetailUsageViewer\testasp1.aspx:20
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731
Re: Operation must use updatable query
Seems like something is wrong with your query. Post the source code that is giving you error. My immediate guess would be that com.ExecuteNonQuery() is giving an error.
Re: Operation must use updatable query
Re: Operation must use updatable query
I once got this exception when the database was read-only (Access). Making it writable again solved the problem.
1 Attachment(s)
Re: Operation must use updatable query
Thanks everybody,
I attached three sample files I used...
If you can run without error, then my machine may be wrong...
If you can't also run, then my code may be wrong...