|
 |
access_asp thread: UPDATE
Message #1 by "Brendan O'Grady" <9843922@s...> on Wed, 13 Mar 2002 19:56:38
|
|
Hi im am trying to use the update function, but i keep getting this error,
It is an access database.
could anyone post code that works to update info in an access database
"Error Type: ADODB.Recordset (0x800A0CB3) Current Recordset
does not support updating. This may be a limitation of the provider, or
of the selected locktype. "
Message #2 by "Ken Schaefer" <ken@a...> on Thu, 14 Mar 2002 10:09:57 +1100
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Brendan O'Grady" <9843922@s...>
Subject: [access_asp] UPDATE
:
: Hi im am trying to use the update function, but i keep getting this error,
: It is an access database.
:
: "Error Type: ADODB.Recordset (0x800A0CB3) Current Recordset
: does not support updating. This may be a limitation of the provider, or
: of the selected locktype. "
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Cool
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: could anyone post code that works to update info in an access database
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
How about you post the code you have, and we can try and fix it. If you just
want code that works, there are numerous samples available on the internet,
and even in the list archives.
Cheers
Ken
Message #3 by Brendan O'Grady <9843922@s...> on Thu, 14 Mar 2002 03:29:04 +0000
|
|
Hi Here is the code i am working with at the minute,
Thanks Brendan
<%@ LANGUAGE="VBSCRIPT" %>
<%
set Mycon = Server.CreateObject("ADODB.Connection")
Mycon.Open "webstore"
if Session("order_id") = "" then
Response.Write "There is no cuurent order. If you had "
Response.Write "previously added items to your order,"
Response.Write "your session may have Timed out."
Response.Write "<P>"
%>
<% else
p_order_id = Session("order_id")
set prodSet = Server.CreateObject("ADODB.RecordSet")
prodSet.Open "select * from order_items where order_id = "&p_order_id,
Mycon, adLockPessimistic
while not prodSet.EOF
p_element = "quant" & prodSet("prod_id")
p_quant = Request.form(p_element)
prodSet("quantity") = p_quant
prodSet.Update
prodSet.MoveNext
wend
prodSet.Close
set prodSet = Nothing
end if
Mycon.Close
set Mycon = Nothing
%>
----- Original Message -----
From: "Ken Schaefer" <ken@a...>
To: "Access ASP" <access_asp@p...>
Sent: Wednesday, March 13, 2002 11:09 PM
Subject: [access_asp] Re: UPDATE
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> From: "Brendan O'Grady" <9843922@s...>
> Subject: [access_asp] UPDATE
>
>
> :
> : Hi im am trying to use the update function, but i keep getting this
error,
> : It is an access database.
> :
> : "Error Type: ADODB.Recordset (0x800A0CB3) Current Recordset
> : does not support updating. This may be a limitation of the provider, or
> : of the selected locktype. "
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Cool
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> : could anyone post code that works to update info in an access database
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> How about you post the code you have, and we can try and fix it. If you
just
> want code that works, there are numerous samples available on the
internet,
> and even in the list archives.
>
> Cheers
> Ken
>
>
>
>
$subst('Email.Unsub').
Message #4 by "Ken Schaefer" <ken@a...> on Thu, 14 Mar 2002 15:33:04 +1100
|
|
Change your code so that it now reads:
<% @Language="VBScript" %>
<%
Option Explicit
...
objRS.Open strSQL, objConn, adOpenStatic, adLockOptimistic, adCmdText
%>
If you get a variable undefined error (on adOpenStatic), then you need to
read:
www.adopenstatic.com/faq/800a0bb9step2.asp
(and define your constants)
If not, the problem is because the 3rd parameter of the objRS.Open method is
the *cursor type*, not the locktype. The locktype comes 4th. You are passing
in the numeric value of adLockPessimistic as the cursor type (giving you who
knows what cursor), and you are still using the default locktype
(adLockReadOnly) becuase that's not being specified.
Also, something to consider:
You are only using two fields in your recordset. But SELECT * returns all
the fields. It would be faster to just return the two fields you need (plus
the table's primary key).
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Brendan O'Grady" <9843922@s...>
Subject: [access_asp] Re: UPDATE
: Hi Here is the code i am working with at the minute,
: Thanks Brendan
:
:
:
:
:
: <%@ LANGUAGE="VBSCRIPT" %>
:
: <%
:
: set Mycon = Server.CreateObject("ADODB.Connection")
: Mycon.Open "webstore"
:
: if Session("order_id") = "" then
: Response.Write "There is no cuurent order. If you had "
: Response.Write "previously added items to your order,"
: Response.Write "your session may have Timed out."
: Response.Write "<P>"
: %>
: <% else
:
:
: p_order_id = Session("order_id")
:
: set prodSet = Server.CreateObject("ADODB.RecordSet")
: prodSet.Open "select * from order_items where order_id = "&p_order_id,
: Mycon, adLockPessimistic
: while not prodSet.EOF
:
: p_element = "quant" & prodSet("prod_id")
: p_quant = Request.form(p_element)
:
: prodSet("quantity") = p_quant
:
: prodSet.Update
: prodSet.MoveNext
: wend
: prodSet.Close
: set prodSet = Nothing
: end if
:
: Mycon.Close
: set Mycon = Nothing
: %>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Message #5 by Brendan O'Grady <9843922@s...> on Fri, 15 Mar 2002 01:08:18 +0000
|
|
That solved the problem,
Thanks a million Ken
Brendan
----- Original Message -----
From: "Ken Schaefer" <ken@a...>
To: "Access ASP" <access_asp@p...>
Sent: Thursday, March 14, 2002 4:33 AM
Subject: [access_asp] Re: UPDATE
> Change your code so that it now reads:
>
> <% @Language="VBScript" %>
> <%
> Option Explicit
> ...
> objRS.Open strSQL, objConn, adOpenStatic, adLockOptimistic, adCmdText
>
> %>
>
> If you get a variable undefined error (on adOpenStatic), then you need to
> read:
> www.adopenstatic.com/faq/800a0bb9step2.asp
> (and define your constants)
>
> If not, the problem is because the 3rd parameter of the objRS.Open method
is
> the *cursor type*, not the locktype. The locktype comes 4th. You are
passing
> in the numeric value of adLockPessimistic as the cursor type (giving you
who
> knows what cursor), and you are still using the default locktype
> (adLockReadOnly) becuase that's not being specified.
>
> Also, something to consider:
> You are only using two fields in your recordset. But SELECT * returns all
> the fields. It would be faster to just return the two fields you need
(plus
> the table's primary key).
>
> Cheers
> Ken
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> From: "Brendan O'Grady" <9843922@s...>
> Subject: [access_asp] Re: UPDATE
>
>
> : Hi Here is the code i am working with at the minute,
> : Thanks Brendan
> :
> :
> :
> :
> :
> : <%@ LANGUAGE="VBSCRIPT" %>
> :
> : <%
> :
> : set Mycon = Server.CreateObject("ADODB.Connection")
> : Mycon.Open "webstore"
> :
> : if Session("order_id") = "" then
> : Response.Write "There is no cuurent order. If you had "
> : Response.Write "previously added items to your order,"
> : Response.Write "your session may have Timed out."
> : Response.Write "<P>"
> : %>
> : <% else
> :
> :
> : p_order_id = Session("order_id")
> :
> : set prodSet = Server.CreateObject("ADODB.RecordSet")
> : prodSet.Open "select * from order_items where order_id = "&p_order_id,
> : Mycon, adLockPessimistic
> : while not prodSet.EOF
> :
> : p_element = "quant" & prodSet("prod_id")
> : p_quant = Request.form(p_element)
> :
> : prodSet("quantity") = p_quant
> :
> : prodSet.Update
> : prodSet.MoveNext
> : wend
> : prodSet.Close
> : set prodSet = Nothing
> : end if
> :
> : Mycon.Close
> : set Mycon = Nothing
> : %>
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>
|
|
 |