Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Fwd: Trouble with recordset.MoveLast Cmd


Message #1 by ABRAHAM FRIEDMAN <asryf@y...> on Sun, 10 Nov 2002 00:34:15 -0800 (PST)
 
 ABRAHAM FRIEDMAN <asryf@y...> wrote:Date: Sat, 9 Nov 2002 21:12:10 -0800 (PST)
From: ABRAHAM FRIEDMAN 
Subject: Trouble with recordset.MoveLast Cmd
To: asp_databases@p...


Hi 

I'm Having trouble with retreving the Primery Key that was generated - via ASP to the database - back to the recordset and
displaying them the following is the code:

<%
 Dim c, r
 Set c = server.createobject("ADODB.Connection")
c.Open "KeyStone_DSN", "Abraham", "01212799"

 Set r = server.createobject("ADODB.Recordset")
 
 sql = "Select * from customer where 1=2"
r.Open sql, c, 2, 3, 1

r.AddNew
r("First") = "John"
r("Last") = "Klrn"
r("Phone") = "7183651576"
r.Update()
r.MoveLast()

CustomerID = r("CustomerID")
First = r("First")
Last = r("Last")
Phone = r("Phone")
C.Close()
set c = nothing
r.Close = Nothing
set r = nothing

response.write "<html><body>"
response.write "Your name is:" & First & " " & Last & "<br>"
response.write "Your Phone number is:" & Phone
response.write "Your Customer ID is:" & CustomerID
response.write "</body></html>"
%>

The following is the error I get

Error Type:
ADODB.Recordset (0x800A0BCD)
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
/asp/recordadd.asp, line 16

Thanks in advance

Abraham



---------------------------------
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!


---------------------------------
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
Message #2 by "Drew, Ron" <RDrew@B...> on Mon, 11 Nov 2002 07:44:55 -0500
I think you just need to take the r.movelast out. After you update the
record should be available.

-----Original Message-----
From: ABRAHAM FRIEDMAN [mailto:asryf@y...]
Sent: Sunday, November 10, 2002 3:34 AM
To: ASP Databases
Subject: [asp_databases] Fwd: Trouble with recordset.MoveLast Cmd




 ABRAHAM FRIEDMAN <asryf@y...> wrote:Date: Sat, 9 Nov 2002 21:12:10
-0800 (PST)
From: ABRAHAM FRIEDMAN
Subject: Trouble with recordset.MoveLast Cmd
To: asp_databases@p...


Hi

I'm Having trouble with retreving the Primery Key that was generated -
via ASP to the database - back to the recordset and displaying them the
following is the code:

<%
 Dim c, r
 Set c =3D server.createobject("ADODB.Connection")
c.Open "KeyStone_DSN", "Abraham", "01212799"

 Set r =3D server.createobject("ADODB.Recordset")

 sql =3D "Select * from customer where 1=3D2"
r.Open sql, c, 2, 3, 1

r.AddNew
r("First") =3D "John"
r("Last") =3D "Klrn"
r("Phone") =3D "7183651576"
r.Update()
r.MoveLast()

CustomerID =3D r("CustomerID")
First =3D r("First")
Last =3D r("Last")
Phone =3D r("Phone")
C.Close()
set c =3D nothing
r.Close =3D Nothing
set r =3D nothing

response.write "<html><body>"
response.write "Your name is:" & First & " " & Last & "<br>"
response.write "Your Phone number is:" & Phone response.write "Your
Customer ID is:" & CustomerID response.write "</body></html>" %>

The following is the error I get

Error Type:
ADODB.Recordset (0x800A0BCD)
Either BOF or EOF is True, or the current record has been deleted.
Requested operation requires a current record. /asp/recordadd.asp, line
16

Thanks in advance

Abraham



---------------------------------
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!


---------------------------------
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!


  Return to Index