|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
Error msg: Operation must use an updateable query
I'm trying to insert data into a database with a web form and I get the message "Operation must use an updateable query" when I try the page using my own web server. When I upload the pages to a ASP.Net hosting service the page works fine. On my own server I've enabled write permissions on the database and database directory and it still doesn't work.<br><br>I'm running windows XP with IIS 5.1 using an MSAccess database.<br><br>Can someone suggest a possible solution please?
|
|
#2
|
|||
|
|||
|
Do you have a code snippet so we could see what you are trying to do?<p> </p><p><hr size="1" width="50%" align="left" />dotNetBB Forum Developer<br><br><a href="http://www.dotnetbb.com" target="_blank"><img src="http://www.dotnetbb.com/sigs/dnb_468_static.gif" border="0"></a></p>
|
|
#3
|
|||
|
|||
|
This is probably the simplest example of what i'm trying to do. As I said before the code works when I upload it to another server but not when I try to test it on my own.<br>The error occurs when the sever tries to execute the insert into command of the SQL statement on the command "cmd.executeNonQuery()"<br><br><div class="msgQuoteWrap"><div class="msgCode">Sub Button1_Click(sender As Object, e As EventArgs)<br><br>Dim conn as OleDbConnection<br>Dim cmd as OleDbCommand<br><br>' Create Connection using OLEDB<br>conn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("test.mdb"))<br>Dim strSQL as string = "insert into customers (name,address,city,state,zip,country) values ('" & txtname.text & "','" & txtaddress.text & "','" & txtcity.text & "','" & txtstate.text & "','" & txtzip.text & "','" & txtcountry.text & "')"<br>cmd = new OleDbcommand(strSQL,conn)<br><br>' Error Trapping using Try / Catch block<br>Try<br>' Open Connection & execute insert statement<br>conn.Open()<br>cmd.executeNonQuery()<br>conn.close()<br>Catch<br>lblMessage.text = "Database Insertion Failed"<br>exit sub<br>End Try<br><br>lblMessage.text = "Database Insertion Successful"<br>End Sub</div></div>
|
|
#4
|
|||
|
|||
|
I ran into a similar problem when I did not have Access installed locally on one of my development servers. Do you have Access installed on the PC you are getting the error on?<p> </p><p><hr size="1" width="50%" align="left" />dotNetBB Forum Developer<br><br><a href="http://www.dotnetbb.com" target="_blank"><img src="http://www.dotnetbb.com/sigs/dnb_468_static.gif" border="0"></a></p>
|
|
#5
|
|||
|
|||
|
Yes, I have Access 2002 installed on my machine. I have no problems reading data from the database only inserting data.
|
|
#6
|
|||
|
|||
|
I've fixed the problem by editing the machine.config file enabling impersonation as directed by the microsoft support site (link below)<br><br>http://support.microsoft.com/default.aspx?scid=kb;en-us;316675<br><br>Thanks for your help anyway.
|
![]() |
| Viewing: ASP Free Forums > Database > Microsoft SQL Server > Error msg: Operation must use an updateable query |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|