|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
You don't need a fax machine to get faxes. Get a fax-to-email fax number from CallWave. Try it free.
|
|
#1
|
|||
|
|||
|
How to detect that a request has failed
Hi Everybody !
I make a request in ASP which doesn't give automatically a result. That is to say it can be empty. I'd like to know how to detect when the request give nothing (failure) and when it contains fields. I use the following method: Remark : objConnex is the name of the connexion to my database Dim SQL SQL= "SELECT LIBELLE FROM NOM_TABLE" Dim RS Set RS= Server.CreateObject("ADODB.Recordset") RS.Open SQL, objConnex Is it possible, according to you, to retrieve any esception? Does a method exist which applied to the recordset can tell us if it contains smth or not? My application results in an error with RS.Open when the SQL request is empty (falied). Thanks to take a few seconds to help me. Cheers. ___________________________________________________ That's when we make mistakes, that we learn...U agree?! :-) |
|
#2
|
|||
|
|||
|
Ok tipy...I'll do my best to answer your question.
But before I start, I must say that terminology is VERY important so be sure to use the proper wording when asking a question. I'm not saying this to offend you, just so that you know ![]() First you say: -->I make a request in ASP which doesn't give automatically a result<-- Now what do you mean by automatically? Nothing happens automatically even less automagically! So if **YOU** the programmer is using the Request() then you obviously know **WHY** your using it right? Otherwise why use it in the first place? no? doesn't that make sense? Then you say: -->I'd like to know how to detect when the request give nothing (failure) and when it contains fields.<-- The Request() doesn't give failure like you mention, in fact it returns a string and if there is nothing inside that Request() then it will return an empty string! BUT WAIT A MINUTE.................. Oh now I see what you mean...you are NOT talking about the Request() object you're talking about a RECORDSET object Ahhhhhhhh......... that's NOT THE SAME THING!!! (BTW it's not Connexion but Connection) perhaps you might want to rename your variable to simply objConn Anyway... So you are executing an SQL Query, then you obtain a recordset, you then want to check if that recordset holds any value. If it does then do something but if it DOESN'T then do something else! Is that correct? If so, then you simply need to do this: <% Dim SQL SQL= "SELECT LIBELLE FROM NOM_TABLE" Dim RS Set RS= Server.CreateObject("ADODB.Recordset") RS.Open SQL, objConnex If RS.EOF Then 'NO RECORDS INSIDE YOUR RECORDSET 'Take proper action... Else 'YOU HAVE SOME DATA INSIDE YOUR RECORDSET YOUPIIIIIII! 'Take proper action... End If %> EOF stands for (End Of File) Hope this helps! Sincerely Vlince |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > How to detect that a request has failed |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|