But, the problem is that when there is no record matching the emial I pick
up an .EOF or BOF errror, thus I cannot I do a If rs.eof to trap the error
unless I use On Error Resume Next:
set cnn = Server.CreateObject("ADODB.Connection")
strCon = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" &
Server.MapPath("../database/listings.mdb") '//This one is for Access
2000/2002
cnn.Open strCon
SQL = "EXEC Customer @txtEmail='" & email_address & "'"
set rs = cnn.execute(SQL)
'On error resume next
email_address=rs("email_address") '//*** ERROR OCCURS AT THIS POINT, BUT IT
WILL NOT ALLOW
'// ME TO GO TO THE Recordset eof or bof stage UNLESS I place On Error
Resume Next before the variable assignment.
If rs.eof or rs.bof then
etc
End If
I must be missing something here. My query is programmed to accept NULL
values (=ALL RECORDS) or a specific email address for the paramater.
What am I doing wrong here.
- Jason
"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:O8**************@tk2msftngp13.phx.gbl...
cnn.Open strCon
SQL = "EXEC Customer @txtEmail='" & email_address & "'"
set rs = cnn.execute(SQL)
If rs.EOF Then
'''empty
Else
sEmailAddress = rs.fields.item(0).value
End If
I believe that should work just fine. What part don't you like, the
checking for eof? Will this ever be true anyway? That would depend on
your stored procedure. Like, you could make it so that there is always a
result returned.
Ray at work
"jason" <ja***@catamaranco.com> wrote in message
news:uO*************@TK2MSFTNGP10.phx.gbl... Is there a way to avoid On Error Resume Next for:
cnn.Open strCon
SQL = "EXEC Customer @txtEmail='" & email_address & "'"
set rs = cnn.execute(SQL)
'On error resume next
rs("email_address")
'// This record does not exist thus throwing up an error. I could use On
Error to resume and then do this
'// If rs.eof or rs.bof
'//
....But I hate this convention as I find debugging a problem. Is there
a better way?
Thanks
Jason