Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
when db record does not exist.??
Old 02-10-2006, 06:50 AM when db record does not exist.??
ChipJohns's Avatar
I don't know! Do you?

Posts: 488
Name: Chip Johns
Location: Savannah Georgia
Trades: 0
Hi guys,

What ca I do ..

Situation:
User inputs a stock no for an item. When the item does not exist how can I redirect back to the initial form page?

The page receiving the form info first processes the StockNo against the database by way of an sql query (objSR1.)

Then another record set is pulled from another table using another sql query(objSR2) by using WHERE ItemID = objSR1("ItemID")

It works fine when there is an item with the stock number entered, but, when the stock number entered does not exist, the script bombs out during the 2nd sql query

I tried using an IF statement right before the second query like this



IF objRS1("ItemID") <> "" THEN
go ahead and process the query
process the rest of the page

ELSE
response.redirect("find1.asp")
END IF


******
Error Type:
ADODB.Field (0x800A0BCD)
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
/admin/find2a.asp, line 72




Is there a better way??


Thanks,
ChipJohns is offline
Reply With Quote
View Public Profile Visit ChipJohns's homepage!
 
 
Register now for full access!
Old 02-10-2006, 07:50 AM Re: when db record does not exist.??
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Code:
if objRS.eof or objRS.bof then 
' no records found 
else
' some records found
end if
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 02-10-2006, 03:37 PM Re: when db record does not exist.??
ChipJohns's Avatar
I don't know! Do you?

Posts: 488
Name: Chip Johns
Location: Savannah Georgia
Trades: 0
Chris, It worked like a charm. Thanks so much!
ChipJohns is offline
Reply With Quote
View Public Profile Visit ChipJohns's homepage!
 
Reply     « Reply to when db record does not exist.??
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.21464 seconds with 12 queries