ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

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 Dev Shed Forums Sponsor:
You don't need a fax machine to get faxes. Get a fax-to-email fax number from CallWave. Try it free.
  #1  
Old August 21st, 2003, 07:23 AM
tipy tipy is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 22 tipy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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?! :-)

Reply With Quote
  #2  
Old August 21st, 2003, 08:13 AM
Vlince Vlince is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Canada, Quebec, Montreal
Posts: 410 Vlince User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
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

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > How to detect that a request has failed


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

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

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





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway