473,809 Members | 2,506 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

conn.execute(sq l) when failed

1 New Member
Hi,
I was wondering about this statement

Rs=conn.execute ("Select * from table where id=232")

what is the result of Rs if id 232 is not found?
And how do I catch this exception like :
If not Rs then...?

thanks
May 31 '07 #1
1 3391
jhardman
3,406 Recognized Expert Specialist
Hi,
I was wondering about this statement

Rs=conn.execute ("Select * from table where id=232")

what is the result of Rs if id 232 is not found?
And how do I catch this exception like :
If not Rs then...?

thanks
The recordset will show EOF (end of file) as if you were looping thru the recordset and got to the end. To handle, you can say:
Expand|Select|Wrap|Line Numbers
  1. if rs.eof then
  2. ...
  3. end if
or like this...
Expand|Select|Wrap|Line Numbers
  1. if NOT rs.eof then
  2.    'perform all the code you want
  3. else
  4.    response.write "Sorry, no records were found"
  5. end if
Let me nkow if this helps.

Jared
May 31 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
1977
by: mike | last post by:
Am I correct in assuming that when the starting value of a select list is re-selected, the onChange command does not execute? I need to have it execute when the original value is selected if possible. -- Mike
3
9807
by: Lyle Fairfield | last post by:
MS-SQL Server utilities Enterprise Manager and Query Analyzer will model almost any MS-SQL object as a simple script file with a default ".sql" extension. But how to "run these files? They are in a slightly modifies character set and contain commands only usable by the Server's SQL utilities. If one tries to use them on a machine which does not have the SQL utilities installed, one seems to have a laborious cut-and-paste task. (Of...
7
3223
by: JIM.H. | last post by:
Hello, Is there any difference to between SLQ string in the code and call execute query and call a stored procedure and execute the query that way concerning speed, effectiveness, reliability, …? Thanks, Jim.
0
1320
by: satish | last post by:
hi, i have a problem while connecting the Folder in executing sql task in execute sql statements in loop example in Intergration Services --2005 the actual problem -- i have given the sql source as file connection path ie.., existing folder ... and also mentioned in the Enumerated configuration in For Each loop Editor and mentioned *.sql at the Files section -- so the create tables have to be run inside the for loop editor it is not...
4
19698
by: jram01 | last post by:
Hi Folks, I am facing problem to to execute .sql command in sql prompt using perl script. I am able to connect sql promt using " my $odbcinput = "odbcinput.txt"; my $odbcoutput = "odbcoutput.txt"; open (ODBCSQLFH, ">$odbcinput") || die "Unable to create input file ($odbcinput) for odbcsql\n";
1
4383
by: leofdz | last post by:
I tried calling an AS400 stored procedure in SSIS using an execute sql task. The task started executing but never completes and I am not getting any error messsage. There is no problem with AS400 stored proc. I used ADO.Net - ODBC connectivity to connect to AS400 server using IBM client access driver. Please let me know if there is any way to call an AS400 stored proc.
2
37649
by: raghutumma | last post by:
Hi, How can we execute SQL Scripts using Batch file??? i think Batch file should contain Username,Password,Database and Scripts... Using that file scripts should run... How can i give UserName,Password,Database and all those things?
0
1076
by: amitp | last post by:
Hello, I've a DTS Package in which i'm using Execute SQL Task. It's having a connection CON1. I've a function which is defined at DataBase level CON2. The query in the Execute SQL Task is an Update Query. It takes data from CON2 and updates in CON1. SO how can i call the function which is defined at database level into my Execute SQL Task update query. I don't know the syntax. Also that function taking 3 input parameters which i'm...
1
5398
by: theschaef | last post by:
Hi there. I am using perl to connect to a database and then pull the rows off of the table one by one to manipulate the data. If I use a smaller table (~8 MB), I wait for around 20 seconds but then the table values are read just fine. However if I use a larger table (~30 MB), I wait for a while and then I get the message: DBD::mysql::st execute failed: Lost connection to MySQL server during query I have tried searching for the...
0
9721
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9603
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10376
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10120
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9200
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6881
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5689
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.