If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Query Checking...

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-09-06, 02:55
archMEL archMEL is offline
Registered User
 
Join Date: Sep 2006
Posts: 8
Query Checking...

I want to check if a query returns a proper recordset or if is something wrong (a column not found, database not found e.t.c).

I have the following setting fro my query :
strSQL = "select something from table1"
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open strSQL, Conn

How can check if the query is valid so to enter an IF statement so :
If (query = False) Then
Response.Write("There is wrong with the query!")
Else

..... All the things i wanna do when the query is correct
End If

So not to have the annoying white screen message but a proper common user friendly message ???
Reply With Quote
  #2 (permalink)  
Old 11-09-06, 05:20
KillerApp KillerApp is offline
Registered User
 
Join Date: Jul 2004
Posts: 23
You should check Err.Number<>0
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
Pingbacks are On
Refbacks are On