Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / Database Access / June 2008



Tip: Looking for answers? Try searching our database.

Operation must use an updatable query

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
CookNick1970@gmail.com - 26 Jun 2008 12:13 GMT
Hi,

I have a problem with my vb6 application and MS Access database. The
database has only one table. The application inserts data to this
table each 1-2 seconds.

strQry="INSERT INTO table (...) VALUES (...)"
Set adoConn= New ADODB.Connection
adoConn.Open connectionString
adoConn.Execute strQry

Application worked fine for some time but suddenly error "Operation
must use an updatable query" appeared.
I logged the query and tried insert directly to the database - it was
ok.

Does anyone have any suggestion?

Thanks!
Paul Clement - 26 Jun 2008 13:51 GMT
¤ Hi,
¤
¤ I have a problem with my vb6 application and MS Access database. The
¤ database has only one table. The application inserts data to this
¤ table each 1-2 seconds.
¤
¤ strQry="INSERT INTO table (...) VALUES (...)"
¤ Set adoConn= New ADODB.Connection
¤ adoConn.Open connectionString
¤ adoConn.Execute strQry
¤
¤ Application worked fine for some time but suddenly error "Operation
¤ must use an updatable query" appeared.
¤ I logged the query and tried insert directly to the database - it was
¤ ok.
¤
¤ Does anyone have any suggestion?

Is the database located on a network resource?

Paul
~~~~
Microsoft MVP (Visual Basic)
CookNick1970@gmail.com - 26 Jun 2008 22:18 GMT
On Jun 26, 2:51 pm, Paul Clement
<UseAdddressAtEndofMess...@swspectrum.com> wrote:

> ¤ Hi,
> ¤
[quoted text clipped - 19 lines]
> ~~~~
> Microsoft MVP (Visual Basic)

The database is in a local network. It is on the same machine as
application.
argusy - 27 Jun 2008 11:48 GMT
> On Jun 26, 2:51 pm, Paul Clement
> <UseAdddressAtEndofMess...@swspectrum.com> wrote:
[quoted text clipped - 25 lines]
> The database is in a local network. It is on the same machine as
> application.

how long is "for some time", and is this consistent (ie, does it happen
about the same time every time).

Does it happen at the shortest interval (1 second <or less?>)
(You may need to add a time printout to your code to find out)

or, thinking macroscopic instead of microscopic, do you mean the program
worked OK for some months (years?), then stopped working.

Have you tried backing up the database, deleting all records in the
original, and seeing if the problem still occurs.

Has there been any OS/hardware changes (I'm just stretching the
imagination here  - it's unlikely for your problem, but stranger things
have stumped the best of programs)

Think of ANYthing that was done to the database or program about the
time the error started occuring.

Your info is rather brief, so there are all sorts of questions that you
could be asked. Please be patient and be prepared to get asked a bit
more about your program, so that you or someone else can come up with
the right answer to your query.
CookNick1970@gmail.com - 27 Jun 2008 15:06 GMT
> CookNick1...@gmail.com wrote:
> > On Jun 26, 2:51 pm, Paul Clement
[quoted text clipped - 52 lines]
>
> - Show quoted text -

it worked fine for months (9), stopped from time to time (once in a
week).

I put new database instead of the old and the same error occurred
again after few hours (4-5) of proper functioning. After few hours (2)
again. And after 5 hours again.

As far as I know there were ne changs on this machine.

Thanks for your time!
Ralph - 30 Jun 2008 01:00 GMT
On Jun 27, 12:48 pm, argusy <arg...@slmember.on.net> wrote:
<snipped>
> >> ¤
> >> ¤ strQry="INSERT INTO table (...) VALUES (...)"
> >> ¤ Set adoConn= New ADODB.Connection
> >> ¤ adoConn.Open connectionString
> >> ¤ adoConn.Execute strQry
> >> ¤

I can't think of anything specific, but ..., I would be uncomfortable with
creating a new Connection every 1-2 seconds if the above is a true
reflection of your code.

ADO uses connection pooling. Thus it is possible with a tight loop to
actually have more than one "connection". [The error "Operation must use an
updatable query" is to some extent a catch-all.] This 'new' connection will
not be reflective of any specific lock/cursor attributes you may have set
but the default authentication info.

One would have to know more about the specific code you are using to provide
more information. But in the meantime try creating a single ADODB Connection
object outside the 1-2 second loop, and then arrange your code to do
something like this ...

' on init of App ..
Dim adoConn As ADODB.Connection
Set adoConn = New ADODB.Connection
' set the connection string
' set the attributes
...
' loop
       ' create strQry
   adoConn.Open
   adoConn.Execute strQry
   adoConn.Close
   ...
' on termination of app
 Set adoConn = Nothing

and see if the problem doesn't go away.

Also, are you enumerating the ADODB.Connection.Errors collection to check
for additional information?

-ralph
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.