473,395 Members | 1,649 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

recordset

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
5 4231
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: gary artim | last post by:
Hi All, I have a problem using DBIx::RecordSet. I get correct results but continue to get these messages on stderr. I looked at Compat.pm and it seems to be pointing out a problem with my call...
4
by: Tom | last post by:
I want to open a recordset object on an .asp page. When I open the recordset I would like to use a stored procedure that expects a parameter to be passed for the stored procedure. I will then use...
19
by: Adam Short | last post by:
I am trying to write a routine that will connect a .NET server with a classic ASP server. I know the following code doesn't work! The data is being returned as a dataset, however ASP does not...
0
by: CFW | last post by:
I thought this was going to be easy but I'm missing something . . . I need to open an ADODB recordset using the recordset source for a list box on my for. When my form opens, the list box ADODB...
6
by: lenny | last post by:
Hi, I've been trying to use a Sub or Function in VBA to connect to a database, make a query and return the recordset that results from the query. The connection to the database and the query...
36
by: kjvt | last post by:
Based on a prior posting, I've written a function to convert a recordset to a dataview. The first call to the function for a given recordset works perfectly, but the second call always returns a...
0
ADezii
by: ADezii | last post by:
Most Access Users realize that Recordsets, being virtual representations of a Query, Table, or SQL Statement, exist only in our PC's memory. They, and the data they contain, literally exist at one...
0
ADezii
by: ADezii | last post by:
When you create an ADO Recordset, you should have some idea as to what functionality the Recordset does/does not provide. Some critical questions may, and should, be: Can I add New Records to the...
6
by: Oko | last post by:
I'm currently developing an MS Access Data Project (.adp) in MS Access 2002. One of the reports within the DB uses data that is Dynamic and cannot be stored on the SQL Server. To resolve this, I...
2
by: wallconor | last post by:
Hi, I am having a problem using Dreamweaver CS3 standard recordset paging behavior. It doesn’t seem to work when I pass parameter values from a FORM on my search page, to the recordset on my...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.