|
 |
asp_databases thread: Requested Operation requires current record. Chapter 15. Beg ASP
Message #1 by gailmac1@h... on Wed, 22 Aug 2001 02:50:40
|
|
I am using the AddUser.asp from Chapter 15 for a template. When I try to
submit the information I get the following error(this page is suppose to
either add a new record or update an existing one):
ADODB.Recordset error '800a0bcd'
Either BOF or EOF is True, or the current record has been deleted.
Requested operation requires a current record. (line 29, which is the
rsUsers ("Email") = Request.Form("EMail") line. Any ideas? Also, would it
be better to submit/update information using SQL instead. If so, I don't
know how to do that, so if you could provide a source on where to find the
information or suggestions it would be greatful.
Here's my code:
<% Response.Buffer = true %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Hidden ASP</title>
<meta name="Microsoft Border" content="none, default">
</head>
<!--#include file="JobBoard.asp"-->
<body>
<%
Dim rsUsers
Set rsUsers = Server.CreateObject ("ADODB.Recordset")
rsUsers.Open "UserRegistration", objConn, adOpenForwardOnly,
adLockOptimistic, adCmdTable
If Session ("EMail") <> " " Then
rsUsers.Filter = "EMail = '" & Session("EMail") & "'"
Else
rsUsers.Filter = "EMail = ' " & Request.Form("EMail")
& "'" &_
"AND Password = '" & Request.Form("Password") & "'"
End If
rsUsers("EMail") = Request.Form("EMail")
rsUsers("Password") = Request.Form("Password")
rsUsers("FirstName") = Request.Form("FirstName")
rsUsers("LastName") = Request.Form("LastName")
If rsUsers.EOF Then
rsUsers.AddNew
Else
rsUsers.Update
End If
Dim strName, strValue
For each strField in rsUsers.Fields
strName =strField.Name
strValue =strField.Value
Session(strName)= strValue
Next
Session("blnValidUder")=True
Response.Flush
Response.Redirect "MyProfile.asp"
%>
Thanks again,
Gail
gailmac1@h...
Message #2 by "Ken Schaefer" <ken@a...> on Wed, 22 Aug 2001 16:38:56 +1000
|
|
You're code is a bit muddled. What you want to do is "if there are no
records in the recordset, then call .addNew"
eg (immediately after the .Filter part);
<%
If rsUsers.EOF then
rsUsers.AddNew
End If
rsUsers("EMail") = Request.Form("EMail")
rsUsers("Password") = Request.Form("Password")
rsUsers("FirstName") = Request.Form("FirstName")
rsUsers("LastName") = Request.Form("LastName")
rsUsers.Update
%>
That all said, SQL statements are a better way to go. Here is a decent
tutorial:
http://w3.one.net/~jhoffman/sqltut.htm
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
----- Original Message -----
From: <gailmac1@h...>
To: "ASP Databases" <asp_databases@p...>
Sent: Wednesday, August 22, 2001 2:50 AM
Subject: [asp_databases] Requested Operation requires current record.
Chapter 15. Beg ASP
: I am using the AddUser.asp from Chapter 15 for a template. When I try to
: submit the information I get the following error(this page is suppose to
: either add a new record or update an existing one):
:
: ADODB.Recordset error '800a0bcd'
:
: Either BOF or EOF is True, or the current record has been deleted.
: Requested operation requires a current record. (line 29, which is the
: rsUsers ("Email") = Request.Form("EMail") line. Any ideas? Also, would it
: be better to submit/update information using SQL instead. If so, I don't
: know how to do that, so if you could provide a source on where to find the
: information or suggestions it would be greatful.
:
: Here's my code:
:
: <% Response.Buffer = true %>
Message #3 by David Cameron <dcameron@i...> on Wed, 22 Aug 2001 15:43:16 +1000
|
|
The problem is that you are trying to access fields from a recordset that is
not returning any records.
Corrected section of code:
<snip>
If Session ("EMail") <> " " Then
rsUsers.Filter = "EMail = '" & Session("EMail") & "'"
Else
rsUsers.Filter = "EMail = ' " & Request.Form("EMail") _
& "' AND Password = '" & _
Request.Form("Password") & "'"
End If
If rsUsers.EOF Then
rsUsers.AddNew
End If
rsUsers("EMail") = Request.Form("EMail")
rsUsers("Password") = Request.Form("Password")
rsUsers("FirstName") = Request.Form("FirstName")
rsUsers("LastName") = Request.Form("LastName")
rsUsers.Update
</snip>
regards
David Cameron
nOw.b2b
dcameron@i...
-----Original Message-----
From: gailmac1@h... [mailto:gailmac1@h...]
Sent: Wednesday, 22 August 2001 12:51 PM
To: ASP Databases
Subject: [asp_databases] Requested Operation requires current record.
Chapter 15. Beg ASP
I am using the AddUser.asp from Chapter 15 for a template. When I try to
submit the information I get the following error(this page is suppose to
either add a new record or update an existing one):
ADODB.Recordset error '800a0bcd'
Either BOF or EOF is True, or the current record has been deleted.
Requested operation requires a current record. (line 29, which is the
rsUsers ("Email") = Request.Form("EMail") line. Any ideas? Also, would it
be better to submit/update information using SQL instead. If so, I don't
know how to do that, so if you could provide a source on where to find the
information or suggestions it would be greatful.
Here's my code:
<% Response.Buffer = true %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Hidden ASP</title>
<meta name="Microsoft Border" content="none, default">
</head>
<!--#include file="JobBoard.asp"-->
<body>
<%
Dim rsUsers
Set rsUsers = Server.CreateObject ("ADODB.Recordset")
rsUsers.Open "UserRegistration", objConn, adOpenForwardOnly,
adLockOptimistic, adCmdTable
If Session ("EMail") <> " " Then
rsUsers.Filter = "EMail = '" & Session("EMail") & "'"
Else
rsUsers.Filter = "EMail = ' " & Request.Form("EMail")
& "'" &_
"AND Password = '" & Request.Form("Password") & "'"
End If
rsUsers("EMail") = Request.Form("EMail")
rsUsers("Password") = Request.Form("Password")
rsUsers("FirstName") = Request.Form("FirstName")
rsUsers("LastName") = Request.Form("LastName")
If rsUsers.EOF Then
rsUsers.AddNew
Else
rsUsers.Update
End If
Dim strName, strValue
For each strField in rsUsers.Fields
strName =strField.Name
strValue =strField.Value
Session(strName)= strValue
Next
Session("blnValidUder")=True
Response.Flush
Response.Redirect "MyProfile.asp"
%>
Thanks again,
Gail
gailmac1@h...
Message #4 by gailmac1@h... on Wed, 22 Aug 2001 13:52:49
|
|
I originally had it the way you are describing, however, I was getting the
same error message. I will fool with it a little tonight. Maybe I am wrong
and then get back to you guys. Thanks for the response. Please check later
to see if I need additional help.
Gail
|
|
 |