I am using MS Access Database with C# and creating a web service. For connection with database I am using following 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();
Now I am inserting some rows in a table using code. I am using following code for that
//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();
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 cmd.ExecuteNonQuery() throwing a run time exception and its not inserting any values in database.
Exception
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& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& 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
What type of issue is that?