473,406 Members | 2,816 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

INSERT error :: Updateable query?

I am picking up an error message on a straightforward INSERT - do I need an
optimistic-type to get this working....here is is the error:

Microsoft JET Database Engine error '80004005' Operation must use an
updateable query. /catamaranco/accounts/email_inc.asp, line 264
Set cnn = CreateObject("ADODB.Connection")
strCon = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" &
Server.MapPath("../database/acc.mdb") '//This one is for Access 2000/2002
cnn.Open(strCon)

SQL = "INSERT INTO tblCheck_Request (Department_ID, Authorizer_ID,
Requester_ID, Payee, Check_Reason, Amount, Deadline_Date, Yacht) VALUES ("

SQL=SQL & "'" & Department_ID & "', "

SQL=SQL & "'" & Authorizer_ID & "', "

SQL=SQL & "'" & Requester_ID & "', "

SQL=SQL & "'" & Payee & "', "

SQL=SQL & "'" & Check_Reason & "', "

SQL=SQL & "'" & Amount & "', "

SQL=SQL & "'" & Deadline_Date & "', "

SQL=SQL & "'" & Yacht & "')"

Response.Write SQL
Set rs = cnn.Execute(SQL)
Jul 19 '05 #1
6 5400
http://www.aspfaq.com/show.asp?id=2062 - updatable cursor
http://www.aspfaq.com/show.asp?id=2009 - 80004005 errors

HTH,
Bob Barrows
PS. You may want to consider parameterizing this query, either using a saved
parameter query, or by parameterizing your SQL statement using "?"
placeholders and Command object per the technique described by Daniel Bush
in this thread:
http://tinyurl.com/jiay
Myself, I prefer the saved parameter query approach. Create a saved query
(call it qInsChkReq) using this SQL:
INSERT INTO tblCheck_Request (Department_ID, Authorizer_ID,
Requester_ID, Payee, Check_Reason, Amount, Deadline_Date, Yacht)
VALUES ([p1], [p2], [p3], [p4], [p5], [p6], [p7], [p8])

Note: no delimiters. Using this technique, you do not have to worry about
delimiting strings and dates. When you run this query in Access (which you
should always do to detect syntax errors), you will be prompted for the 8
parameter values. In ASP, you will provide these values in your code.

In ASP, do this after opening your connection:

cnn.qInsChkReq Department_ID, Authorizer_ID, Requester_ID, _
Payee, Check_Reason, Amount, Deadline_Date, Yacht

That's it. Again: notice that no delimiters or concatenation had to be used.
And, you don't have to worry about escaping literal quotes in your string
data.

You still have to take care of the permissions problem discussed in the
aspfaq articles.
jason wrote:
I am picking up an error message on a straightforward INSERT - do I
need an optimistic-type to get this working....here is is the error:

Microsoft JET Database Engine error '80004005' Operation must use an
updateable query. /catamaranco/accounts/email_inc.asp, line 264
Set cnn = CreateObject("ADODB.Connection")
strCon = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" &
Server.MapPath("../database/acc.mdb") '//This one is for Access
2000/2002 cnn.Open(strCon)

SQL = "INSERT INTO tblCheck_Request (Department_ID, Authorizer_ID,
Requester_ID, Payee, Check_Reason, Amount, Deadline_Date, Yacht)
VALUES ("

SQL=SQL & "'" & Department_ID & "', "

SQL=SQL & "'" & Authorizer_ID & "', "

SQL=SQL & "'" & Requester_ID & "', "

SQL=SQL & "'" & Payee & "', "

SQL=SQL & "'" & Check_Reason & "', "

SQL=SQL & "'" & Amount & "', "

SQL=SQL & "'" & Deadline_Date & "', "

SQL=SQL & "'" & Yacht & "')"

Response.Write SQL
Set rs = cnn.Execute(SQL)


Jul 19 '05 #2
Thanks Bob - I am trying to confirm from my host provider is they have
permissions enabled - its wierd as I am almost certain they do.

Re: Paramatized queries - I have just recently discovered the beauty of
these in another application...I will start doing it the way you described:

But I notice you did not:

1. Flag PARAMETER at the top of the saved query: eg PARAMETER p1 Long

Also, Do you use the following command to execute the para. query (including
dates):

SQL = "EXEC qry_Listings @P1" & varPI

set rs = cnn.execute(SQL)

....Is this good enough - or, is the command object a better choice?

Cheers

Jason

"Bob Barrows" <re*******@yahoo.com> wrote in message
news:Or**************@TK2MSFTNGP12.phx.gbl...
http://www.aspfaq.com/show.asp?id=2062 - updatable cursor
http://www.aspfaq.com/show.asp?id=2009 - 80004005 errors

HTH,
Bob Barrows
PS. You may want to consider parameterizing this query, either using a saved parameter query, or by parameterizing your SQL statement using "?"
placeholders and Command object per the technique described by Daniel Bush
in this thread:
http://tinyurl.com/jiay
Myself, I prefer the saved parameter query approach. Create a saved query
(call it qInsChkReq) using this SQL:
INSERT INTO tblCheck_Request (Department_ID, Authorizer_ID,
Requester_ID, Payee, Check_Reason, Amount, Deadline_Date, Yacht)
VALUES ([p1], [p2], [p3], [p4], [p5], [p6], [p7], [p8])

Note: no delimiters. Using this technique, you do not have to worry about
delimiting strings and dates. When you run this query in Access (which you
should always do to detect syntax errors), you will be prompted for the 8
parameter values. In ASP, you will provide these values in your code.

In ASP, do this after opening your connection:

cnn.qInsChkReq Department_ID, Authorizer_ID, Requester_ID, _
Payee, Check_Reason, Amount, Deadline_Date, Yacht

That's it. Again: notice that no delimiters or concatenation had to be used. And, you don't have to worry about escaping literal quotes in your string
data.

You still have to take care of the permissions problem discussed in the
aspfaq articles.
jason wrote:
I am picking up an error message on a straightforward INSERT - do I
need an optimistic-type to get this working....here is is the error:

Microsoft JET Database Engine error '80004005' Operation must use an
updateable query. /catamaranco/accounts/email_inc.asp, line 264
Set cnn = CreateObject("ADODB.Connection")
strCon = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" &
Server.MapPath("../database/acc.mdb") '//This one is for Access
2000/2002 cnn.Open(strCon)

SQL = "INSERT INTO tblCheck_Request (Department_ID, Authorizer_ID,
Requester_ID, Payee, Check_Reason, Amount, Deadline_Date, Yacht)
VALUES ("

SQL=SQL & "'" & Department_ID & "', "

SQL=SQL & "'" & Authorizer_ID & "', "

SQL=SQL & "'" & Requester_ID & "', "

SQL=SQL & "'" & Payee & "', "

SQL=SQL & "'" & Check_Reason & "', "

SQL=SQL & "'" & Amount & "', "

SQL=SQL & "'" & Deadline_Date & "', "

SQL=SQL & "'" & Yacht & "')"

Response.Write SQL
Set rs = cnn.Execute(SQL)


Jul 19 '05 #3
Thanks - I'll check with my host to confirm permissions assignment...seems
to be what aspfaq.com is recommending....

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:u5**************@TK2MSFTNGP09.phx.gbl...
www.aspfaq.com

Also, don't do:
Set rs = cnn.Execute(SQL)
Just do:
cnn.Execute SQL

Ray at home

--
Will trade ASP help for SQL Server help
"jason" <ja***@catamaranco.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
I am picking up an error message

Microsoft JET Database Engine error '80004005' Operation must use an
updateable query. /catamaranco/accounts/email_inc.asp, line 264


Jul 19 '05 #4
jason wrote:
Thanks Bob - I am trying to confirm from my host provider is they have
permissions enabled - its wierd as I am almost certain they do.

Re: Paramatized queries - I have just recently discovered the beauty
of these in another application...I will start doing it the way you
described:

But I notice you did not:

1. Flag PARAMETER at the top of the saved query: eg PARAMETER p1 Long
Not necessary. But it does help enforce data typing.
Also, Do you use the following command to execute the para. query
(including dates):

SQL = "EXEC qry_Listings @P1" & varPI

set rs = cnn.execute(SQL)
You must have missed this in my post. I said no concatenation was needed. I
showed the technique I would use:
cnn.qInsChkReq Department_ID, Authorizer_ID, Requester_ID, _
Payee, Check_Reason, Amount, Deadline_Date, Yacht


Actually, you may have to do this (I rarely use Access):
cnn.qInsChkReq Department_ID, Authorizer_ID, Requester_ID, _
Payee, Check_Reason, Amount, CDate(Deadline_Date), Yacht


...Is this good enough - or, is the command object a better choice?


While I prefer the above technique when using Access, IMO, a Command object
is a better choice than concatenating the call to the procedure (I avoid
concatenation whenever possible). When you use concatenation, you have all
the headaches from having to remember to delimit the string and date
parameters, as well as having to escape literal delimiters in your
parameters.

Aaron disagrees. He contends that it is easier to use concatenation because
it allows you to response.write the concatenated statement for debugging
purposes. I disagree: to me, the need to response.write the statement for
debugging is caused by the complication of having to worry about delimiters.
In other words, if you weren't using such an error-prone technique, you
would not have to worry about debugging it as much.

For more of my reasoning, check out this post:
http://tinyurl.com/jifs

HTH,
Bob Barrows
Jul 19 '05 #5
> Aaron disagrees. He contends that it is easier to use concatenation
because
it allows you to response.write the concatenated statement for debugging
purposes. I disagree: to me, the need to response.write the statement for
debugging is caused by the complication of having to worry about

delimiters.

Well, my usual desire for using response.write to debug the SQL statement is
fourfold: to check delimiters for different data types, to check values of
*all* variables in one spot, to copy to Query Analyzer so I can alter the
statement slightly to see why I'm not getting the desired results, and to
copy to Query Analyzer to generate showplan / statistics etc. to see why my
performance stinks. It's not solely because using delimiters is, as you
call it, "error-prone."

A
Jul 19 '05 #6
Aaron Bertrand [MVP] wrote:
Aaron disagrees. He contends that it is easier to use concatenation
because it allows you to response.write the concatenated statement
for debugging purposes. I disagree: to me, the need to
response.write the statement for debugging is caused by the
complication of having to worry about delimiters.


Well, my usual desire for using response.write to debug the SQL
statement is fourfold: to check delimiters for different data types,
to check values of *all* variables in one spot, to copy to Query
Analyzer so I can alter the statement slightly to see why I'm not
getting the desired results, and to copy to Query Analyzer to
generate showplan / statistics etc. to see why my performance stinks.
It's not solely because using delimiters is, as you call it,
"error-prone."

A


Understood. Given that I had the first word, I will leave you with the last
word. :-)
Jul 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: jason | last post by:
I am picking up the following error message which is strange as it has only started happening since I have transferred servers: Microsoft JET Database Engine error '80004005' Operation must use...
8
by: Sans Spam | last post by:
Greetings! I have a table that contains all of the function permissions within a given application. These functions are different sections of a site and each has its own permissions (READ, WRITE,...
2
by: Mano kumar | last post by:
hello guys, i'm having a very strange problem, this is a simple insert code. andthe insert stmt has NO problem cos i've tried it on my access table. and heres the error msg Operation must use...
3
by: Pravin A. Sable | last post by:
Dear All I am trying to execute following cod Sub SubmitBtn_Click(ByVal Sender As Object, ByVal E As EventArgs Dim DBConn As OleDbConnectio Dim DBInsert As New OleDbComman DBConn = New...
0
by: Sharon | last post by:
I have a problem using with dbf file here. I have tried the code below using VB.NET with no errors. However, I use the exact same code in ASP NET, it prompt me error when I tried to insert a...
3
by: Shapper | last post by:
Hello, I have created 3 functions to insert, update and delete an Access database record. The Insert and the Delete code are working fine. The update is not. I checked and my database has all...
7
by: Larry B via DotNetMonster.com | last post by:
Hello, I seem to be having a problem with inserting data, from a web form, into an access database. I have tried to do the same thing in a regular windows app, there it works fine, but when I...
4
by: agarwalsunitadhn | last post by:
Hello.. I had deployed my project and created a setup file. when i install this one to my system. All the pages works but when i have insert query then it shows an error. is it only a backup file...
0
by: rickmedlin | last post by:
I know this has been posted on elsewhere but I'm stuck. I'm using the following append query to copy an Access query to Excel: INSERT INTO . SELECT * FROM Test; This isn't the real table...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.