Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old August 13th, 2004, 08:47 AM
bobbabuoy bobbabuoy is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 65 bobbabuoy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 34 m 56 sec
Reputation Power: 6
Empty Recordset Error

I am trying to run the following asp function:
Code:
Private Function GetAbs(dThisDate, lPartID)
	sql_abs = "SELECT AbsCode FROM Absence WHERE AbsDate = '" & dThisDate & "' AND PartID = " & lPartID
	Set rs_abs = conn.Execute(sql_abs)
	GetAbs = rs_abs(0).Value
	Set rs_abs = Nothing
End Function


It works fine if it finds a record but returns an error if it doesn't. How can I avoid this error?

Thanks!

Reply With Quote
  #2  
Old August 13th, 2004, 01:10 PM
blicci's Avatar
blicci blicci is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Location: Philly
Posts: 351 blicci User rank is Sergeant Major (2000 - 5000 Reputation Level)blicci User rank is Sergeant Major (2000 - 5000 Reputation Level)blicci User rank is Sergeant Major (2000 - 5000 Reputation Level)blicci User rank is Sergeant Major (2000 - 5000 Reputation Level)blicci User rank is Sergeant Major (2000 - 5000 Reputation Level)blicci User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Days 22 h 8 m 5 sec
Reputation Power: 52
You can check to see if the recordset has any rows
If rs_abs.RecordCount > 0 then
GetAbs = rs_abs(0).Value
End If

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft SQL Server > Empty Recordset Error


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT