By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,847 Members | 2,261 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,847 IT Pros & Developers. It's quick & easy.

recordset

P: n/a
asp code:

set conn = Server.CreateObject("ADODB.Connection")
conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.MapPath("/db/upload/stelladb.mdb") & ";"
set rs = Server.CreateObject("ADODB.Recordset")
conn.qGetUser p1,p2,rs
if rs(0) = "Administrator" OR rs(0) = "User" then
session("boolean") = "true"
End if
if Err.number <> 0 then
Response.Write(Err.number & ":" & Err.Description & "<br>")end if
on Error goto 0
conn.close
Set conn = nothing
ms access sql:

SELECT Type FROM Account WHERE username=[p1] AND password=[p2];
The problem that I am facing is that if I enter and invalid username or
password what happens is I get the following error:

"-2147352567:Either BOF or EOF is True, or the current record has been
deleted. Requested operation requires a current record"

How do I solve the problem?.
Eugene Anthony

*** Sent via Developersdex http://www.developersdex.com ***
Jun 23 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Eugene Anthony wrote:
asp code:

set conn = Server.CreateObject("ADODB.Connection")
conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.MapPath("/db/upload/stelladb.mdb") & ";"
set rs = Server.CreateObject("ADODB.Recordset")
conn.qGetUser p1,p2,rs
if rs(0) = "Administrator" OR rs(0) = "User" then
session("boolean") = "true"
End if
if Err.number <> 0 then
Response.Write(Err.number & ":" & Err.Description & "<br>")end if
on Error goto 0
conn.close
Set conn = nothing
ms access sql:

SELECT Type FROM Account WHERE username=[p1] AND password=[p2];
The problem that I am facing is that if I enter and invalid username
or password what happens is I get the following error:

"-2147352567:Either BOF or EOF is True, or the current record has been
deleted. Requested operation requires a current record"

How do I solve the problem?.

Never try to check the contents of a recordset without first determining
that it has records by checking its eof property:

conn.qGetUser p1,p2,rs
if not rs.eof then
if rs(0) = "Administrator" OR rs(0) = "User" then
session("boolean") = "true"
End if
etc.
end if
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jun 23 '06 #2

P: n/a
On Fri, 23 Jun 2006 10:39:03 -0700, Eugene Anthony <so***********@yahoo.com> wrote:
asp code:

set conn = Server.CreateObject("ADODB.Connection")
conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.MapPath("/db/upload/stelladb.mdb") & ";"
set rs = Server.CreateObject("ADODB.Recordset")
conn.qGetUser p1,p2,rs Inser
if rs(0) = "Administrator" OR rs(0) = "User" then
session("boolean") = "true"
End if
if Err.number <> 0 then
Response.Write(Err.number & ":" & Err.Description & "<br>")end if
on Error goto 0
conn.close
Set conn = nothing
ms access sql:

SELECT Type FROM Account WHERE username=[p1] AND password=[p2];
The problem that I am facing is that if I enter and invalid username or
password what happens is I get the following error:

"-2147352567:Either BOF or EOF is True, or the current record has been
deleted. Requested operation requires a current record"

How do I solve the problem?.
Eugene Anthony

*** Sent via Developersdex http://www.developersdex.com ***


That is expected behavior...No records were returned to the dataset so BOF or EOF is 'seen' by the code..

Place a test for those conditions BEFORE trying to access any of the returned data.
Your error trap expects data to be in the rs.
Jun 23 '06 #3

P: n/a
When no records are returned does it mean rs is null?

What is the difference between

if rs.status = null then
.....code
end if

and

if not rs.eof then
....code
end if

Eugene Anthony wrote:
asp code:

set conn = Server.CreateObject("ADODB.Connection")
conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.MapPath("/db/upload/stelladb.mdb") & ";"
set rs = Server.CreateObject("ADODB.Recordset")
conn.qGetUser p1,p2,rs
if rs(0) = "Administrator" OR rs(0) = "User" then
session("boolean") = "true"
End if
if Err.number <> 0 then
Response.Write(Err.number & ":" & Err.Description & "<br>")end if
on Error goto 0
conn.close
Set conn = nothing
ms access sql:

SELECT Type FROM Account WHERE username=[p1] AND password=[p2];
The problem that I am facing is that if I enter and invalid username or
password what happens is I get the following error:

"-2147352567:Either BOF or EOF is True, or the current record has been
deleted. Requested operation requires a current record"

How do I solve the problem?.
Eugene Anthony

*** Sent via Developersdex http://www.developersdex.com ***


Jun 24 '06 #4

P: n/a
When no records are returned does it mean rs is null?

What is the difference between

if rs.status = null then
.....code
end if

and

if not rs.eof then
....code
end if

Eugene Anthony wrote:
asp code:

set conn = Server.CreateObject("ADODB.Connection")
conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.MapPath("/db/upload/stelladb.mdb") & ";"
set rs = Server.CreateObject("ADODB.Recordset")
conn.qGetUser p1,p2,rs
if rs(0) = "Administrator" OR rs(0) = "User" then
session("boolean") = "true"
End if
if Err.number <> 0 then
Response.Write(Err.number & ":" & Err.Description & "<br>")end if
on Error goto 0
conn.close
Set conn = nothing
ms access sql:

SELECT Type FROM Account WHERE username=[p1] AND password=[p2];
The problem that I am facing is that if I enter and invalid username or
password what happens is I get the following error:

"-2147352567:Either BOF or EOF is True, or the current record has been
deleted. Requested operation requires a current record"

How do I solve the problem?.
Eugene Anthony

*** Sent via Developersdex http://www.developersdex.com ***


Jun 24 '06 #5

P: n/a
solomon_13000 wrote:
When no records are returned does it mean rs is null?
No
What is the difference between

if rs.status = null then
....code
end if

status should not be null. status has nothing to do with whether or not the
recordset contains records:
http://msdn.microsoft.com/library/en...dprostatus.asp
and

if not rs.eof then
...code
end if

http://msdn.microsoft.com/library/en...m/mdprobof.asp

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jun 24 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.