Ask a Question related to ASP Database, Design and Development.
-
Susana #1
Why adOpenForwardOnly allows update records?
Why when I open a recordset with a adOpenForwardOnly cursor it''s
allows me to update and add records?
I tried to open my query with all types of cursors and all of them allows me to update records.
adOpenForwardOnly=0
adOpenKeyset=1
adOpenDynamic=2
adOpenStatic=3
Based on all i have read, opening a recordset with adOpenForwardOnly for example,
the cursor can''t move backward and records can''t be updated.
What happen?, with ASP this dosen''t work?
If anybody can help me...
Thanks
Susana Robledo
-----------------------------
This message is posted by [url]http://Asp.ForumsZone.com[/url]
Susana Guest
-
HELP!! I need to know how to update records properly
I'm a DW newbie and need to know how to update multiple records within a repeated region. The DW manuals only explain how to update one record at a... -
How to update records using list???
I have a table with ID and ParentID columns. ID column has values like:10,13,14,15,16 ParentID has values like : 0,10,13,14,15 I also have... -
Update records ASP
Hi who can help me out here? I have a field like this: <input name="link1" value="<%= rstemp("link1") %>"> And this is the new input: <a... -
ANN: Update Multiple Records in ASP
I've put together an article and demo on how to batch update records in a recordset: ... -
Update / Add New Records
I have tried every suggestion I could find on how to set up a form that is using a combo box for record editing to allow the user to add more... -
Bob Barrows #2
Re: Why adOpenForwardOnly allows update records?
Strange. The documentation says: "The default cursor for an ADO Recordset is
a forward-only, read-only cursor located on the server."
That means, if you do not specify the locktype, you should get a read-only
cursor. I tested it with this code:
Dim cn, rs,sServer,sSQL
sServer = "servername"
Set cn=server.createobject("adodb.connection")
Cn.open "Provider=SQLOLEDB;Initial Catalog=" & _
"Northwind;Data Source=" & sServer & _
";UID=xxxxx;Password=xxxxx"
Set rs=server.createobject("adodb.recordset")
sSQL="SELECT EmployeeID, LastName,FirstName " & _
"FROM dbo.Employees"
rs.Open sSQL,cn,,,adCmdText
rs(1) = "a" & rs(1)
rs.Update
Response.Write rs(1)
rs.Close
Set rs = nothing
Cn.close
Set cn=nothing
Sure enough, I got this error message:
Current Recordset does not support updating. This may be a limitation of the
provider, or of the selected locktype.
I then tried this:
set rs = cn.execute ssql,,adcmdtext
and got the same result.
Bob Barrows
Susana wrote:> Why when I open a recordset with a adOpenForwardOnly cursor it''s
> allows me to update and add records?
>
> I tried to open my query with all types of cursors and all of them
> allows me to update records.
>
> adOpenForwardOnly=0
> adOpenKeyset=1
> adOpenDynamic=2
> adOpenStatic=3
>
> Based on all i have read, opening a recordset with adOpenForwardOnly
> for example,
> the cursor can''t move backward and records can''t be updated.
>
> What happen?, with ASP this dosen''t work?
>
> If anybody can help me...
>
> Thanks
>
> Susana Robledo
>
> -----------------------------
> This message is posted by [url]http://Asp.ForumsZone.com[/url]
Bob Barrows Guest
-
Susana Robledo #3
Re: Why adOpenForwardOnly allows update records?
Thanks Bob for answer.
But you get this error because you are using a adLockReadOnly (1) lock
type.
Why don't you try to use another lock type such as adLockOptimistic
(3)or adLockPessimistic (2)?
Open the recordset with adOpenForwardOnly (0) Cursor type and you'll see
that there's no error there. (???)
Thanks
Susana
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
Susana Robledo Guest
-
Aaron Bertrand - MVP #4
Re: Why adOpenForwardOnly allows update records?
Where did you read that a forwardOnly cursor makes all locktypes read only?
"Susana Robledo" <anonymous@devdex.com> wrote in message
news:#QoHUf6SDHA.1916@TK2MSFTNGP12.phx.gbl...>
>
> Thanks Bob for answer.
>
> But you get this error because you are using a adLockReadOnly (1) lock
> type.
>
> Why don't you try to use another lock type such as adLockOptimistic
> (3)or adLockPessimistic (2)?
>
> Open the recordset with adOpenForwardOnly (0) Cursor type and you'll see
> that there's no error there. (???)
>
> Thanks
>
> Susana
>
> *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
> Don't just participate in USENET...get rewarded for it!
Aaron Bertrand - MVP Guest
-
Bob Barrows #5
Re: Why adOpenForwardOnly allows update records?
Susana Robledo wrote:
I thought you were questioning why you get an updatable recordset when using> Thanks Bob for answer.
>
> But you get this error because you are using a adLockReadOnly (1) lock
> type.
>
> Why don't you try to use another lock type such as adLockOptimistic
> (3)or adLockPessimistic (2)?
>
adForwardOnly! If you use adLockOptimistic (3)or adLockPessimistic (2), you
will get an updatable cursor regardless of cursor type.
I DID open with adOpenForwardOnly. When you don't specify the type, you get> Open the recordset with adOpenForwardOnly (0) Cursor type and you'll
> see that there's no error there. (???)
the default type, which is adOpenForwardOnly.
Please show the code that has you puzzled.
Bob Barrows
Bob Barrows Guest
-
Ken Schaefer #6
Re: Why adOpenForwardOnly allows update records?
What locktype you get depends on:
a) what cursor type you ask for
b) the cursor location specified
c) what the provider supports.
For example, if you specify a client-side cursor, you will always get an
adOpenStatic cursor. For some providers the lock type will also change.
Jet (Access), for example, only supports a limited number of possible
combinations. Asking for any sort of updateable cursor results in the cursor
type changing (to Keyset or Static), even if you ask for a ForwardOnly
cursor. What you need to do is check *after* you have opened the recordset
to see what you actually got:
<%
objRS.LockType = adLockOptimistic
objRS.CursorType = adOpenForwardOnly
objRS.Open
Response.Write("Lock type is now: " & objRS.LockType)
Response.Write("Cursor type is now: " & objRS.CursorType)
%>
[url]http://www.adopenstatic.com/faq/jetcursortypes.asp[/url]
Cheers
Ken
"Susana Robledo" <anonymous@devdex.com> wrote in message
news:%23QoHUf6SDHA.1916@TK2MSFTNGP12.phx.gbl...
:
:
: Thanks Bob for answer.
:
: But you get this error because you are using a adLockReadOnly (1) lock
: type.
:
: Why don't you try to use another lock type such as adLockOptimistic
: (3)or adLockPessimistic (2)?
:
: Open the recordset with adOpenForwardOnly (0) Cursor type and you'll see
: that there's no error there. (???)
:
: Thanks
:
: Susana
:
: *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
: Don't just participate in USENET...get rewarded for it!
Ken Schaefer Guest



Reply With Quote

