Note that there are some explanatory texts on larger screens.

plurals
  1. POMS Access Database with C# at IIS Server
    text
    copied!<p>I am using MS Access Database with C# and creating a web service. For connection with database I am using following code</p> <pre><code>String databasePath = @"C:\inetpub\wwwroot\02 CustomerCreate\CustomerCreate\adResDemo.mdb"; String Connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + databasePath + ";Persist Security Info=False"; //Connection to database con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + databasePath + ";Persist Security Info=False"); con.Open(); </code></pre> <p>Now I am inserting some rows in a table using code. I am using following code for that</p> <pre><code>//Query For ZipCode Insertion String zipQuery = "INSERT INTO ZipCodes(ZipCode, City, State, DeliveryCharge, DeliveryComp, AutoID, RowGUID) VALUES ('" + PostCode + "','" + City + "','" + State + "'," + DeliveryCharge + "," + DeliveryComp + "," + AutoID + ",'" + RowGUIDZipCode + "')"; //Inserts query ZipCodes Table cmd = new OleDbCommand(zipQuery, con); cmd.ExecuteNonQuery(); </code></pre> <p>Now when I am running above code directly on Visual Studio then its working fine and entries in database taking place. But when I am deploying this web service on IIS server <strong>cmd.ExecuteNonQuery()</strong> throwing a run time exception and its not inserting any values in database.</p> <h3>Exception</h3> <pre><code>System.Data.OleDb.OleDbException: Operation must use an updateable query. at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr) at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object&amp; executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object&amp; executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object&amp; executeResult) at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) at System.Data.OleDb.OleDbCommand.ExecuteNonQuery() at CustomerCreate.Service1.createCustomer(String FirstName, String LastName, String EmailAddress, String CompanyName, String StreetAddress, String PostCode, String City, String State, String Country, String PhoneNumber) in C:\inetpub\wwwroot\02 CustomerCreate\CustomerCreate\Service1.asmx.cs:line 141 </code></pre> <p>What type of issue is that?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload