Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

checking for a record, if not say so 1

Status
Not open for further replies.

derwent

Programmer
May 5, 2004
428
GB
People need to enter their login id to progress to the next page. My script works ok if they enter a valid number however if they enter a wrong login that isn`t in the DB, I get an unfriendly error message. Is there a way to check first if the login is correct and if not display a friendly message.

I have

Code:
SQL = "SELECT * FROM logins where id = " & request.form("loginid")
set rs = server.CreateObject("ADODB.RECORDSET")
rs.open SQL,objConn, 3,3
which returns

Microsoft OLE DB Provider for ODBC Drivers error '80040e21'

ODBC driver does not support the requested properties.

/login/index,asp, line 18

(line 18 is the rs.open line)
 
Code:
SQL = "SELECT * FROM logins where id = " & request.form("loginid")
set rs = server.CreateObject("ADODB.RECORDSET")
rs.open SQL,objConn, 3,3

if rs.BOF and rs.EOF then
response.write " Sorry, Invalid Login. Please try again"
else
response.redirect "main.asp"
end if

-DNG
 
Also quote the string id.
>...where id = " & request.form("loginid")
[tt]...where id = [red]'[/red]" & request.form("loginid") [red]& "'"[/red][/tt]
 
that would solve the problem of getting the records...but still if there are no records returned...you need to do the if condition that i suggested...

-DNG
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top