Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: adding data..page 595


Message #1 by "Vandana Sahasrabudhe" <panipuri99@h...> on Mon, 5 Aug 2002 15:35:03
I am trying to add the data using the code given on page 595 of Beginners 
ASp book.

Dim objRs, intID
Set objRs = Server.CreateObject("ADODB.Recordset")
objRs.Open "Canopy", strConn, adOpenStatic, adLockOptimistic, adCmdTable

objRs.movelast
intID = objRs("ID") + 1

objRs.AddNew
objRs("ID") = intID
objRs("FName") = request.form("fName")
objRs("LName") = request.form("lName")

objRs.Update
objRs.close


But I am getting an error as

Error Type:
ADODB.Field (0x80020009)
Either BOF or EOF is True, or the current record has been deleted. 
Requested operation requires a current record

Please let me know where I am doing wrong

Thanks 
Vandana
Message #2 by "Young, Ashley" <Ashley.Young@c...> on Mon, 5 Aug 2002 10:42:56 -0400
It seems like the book is making you go about adding data to a table the
hard way. Try this:

sqlStatement="INSERT INTO tablename(field1,field2,field3) values ('"
&request("field1formfieldname")& "','" &request("field2formfieldname")&
"','" &request("field3formfieldname")& "')"
connection_object_name.execute(sqlStatement)

-----Original Message-----
From: Vandana Sahasrabudhe [mailto:panipuri99@h...]
Sent: Monday, August 05, 2002 10:35 AM
To: Access ASP
Subject: [access_asp] adding data..page 595


I am trying to add the data using the code given on page 595 of Beginners 
ASp book.

Dim objRs, intID
Set objRs = Server.CreateObject("ADODB.Recordset")
objRs.Open "Canopy", strConn, adOpenStatic, adLockOptimistic, adCmdTable

objRs.movelast
intID = objRs("ID") + 1

objRs.AddNew
objRs("ID") = intID
objRs("FName") = request.form("fName")
objRs("LName") = request.form("lName")

objRs.Update
objRs.close


But I am getting an error as

Error Type:
ADODB.Field (0x80020009)
Either BOF or EOF is True, or the current record has been deleted. 
Requested operation requires a current record

Please let me know where I am doing wrong

Thanks 
Vandana

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.377 / Virus Database: 211 - Release Date: 7/15/2002
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.377 / Virus Database: 211 - Release Date: 7/15/2002
 
Message #3 by "Vandana Sahasrabudhe" <panipuri99@h...> on Mon, 5 Aug 2002 16:02:51
I think that would be a better way. But I want to maintain the ID number. 
I don't want it to be autonumber in the access table

How would I do that?

Thanks Vandana
Message #4 by "Young, Ashley" <Ashley.Young@c...> on Mon, 5 Aug 2002 10:53:39 -0400
Vandana,

  Just pass the id number as a form field as well. ;) I don't know why those
beginner ASP books are always making things so difficult.

--Ashley

-----Original Message-----
From: Vandana Sahasrabudhe [mailto:panipuri99@h...]
Sent: Monday, August 05, 2002 11:03 AM
To: Access ASP
Subject: [access_asp] Re: adding data..page 595


I think that would be a better way. But I want to maintain the ID number. 
I don't want it to be autonumber in the access table

How would I do that?

Thanks Vandana

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.377 / Virus Database: 211 - Release Date: 7/15/2002
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.377 / Virus Database: 211 - Release Date: 7/15/2002
 
Message #5 by "Vandana Sahasrabudhe" <panipuri99@h...> on Mon, 5 Aug 2002 16:12:54
OK :-), Thanks! 

  Return to Index