473,382 Members | 1,651 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Return statment

JL
Hi all,

I have a self defined function at following

Function testing()
if a < b then
return a
else
return b
end if
sqlCon.close()

Based on above function, does the system will excute the "sqlCon.close()"
statement after "end if"? or quit the function when excuted the "return"
statement.

Thanks a lot
Nov 18 '05 #1
2 1034
the return statement assigns the return value to the function and exits.
so it will not.

"JL" <jo********@mail.hotmail.com> wrote in message
news:eU**************@tk2msftngp13.phx.gbl...
Hi all,

I have a self defined function at following

Function testing()
if a < b then
return a
else
return b
end if
sqlCon.close()

Based on above function, does the system will excute the "sqlCon.close()"
statement after "end if"? or quit the function when excuted the "return"
statement.

Thanks a lot

Nov 18 '05 #2
try putting the sqlCon.close() in the finally statement

SqlConnnection sqlCon = new SqlConnection("connnection string")
try
{
SqlCommand sqlCommand = new SqlCommand("command name", sqlCon);
// do your processings

your conditional statements
if (a < b)
return a;
else
return b;
}
finally
{
sqlCon.close()
sqlCon.Dispose()
}

the close will then be called no matter what..

HTH

HD

"JL" <jo********@mail.hotmail.com> wrote in message
news:eU**************@tk2msftngp13.phx.gbl...
Hi all,

I have a self defined function at following

Function testing()
if a < b then
return a
else
return b
end if
sqlCon.close()

Based on above function, does the system will excute the "sqlCon.close()"
statement after "end if"? or quit the function when excuted the "return"
statement.

Thanks a lot

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Nils O. Selåsdal | last post by:
given a prototye: string foo(); What would be the diffrence in calling it, and assigning the return value in string a = foo(); vs string &a = foo();
32
by: Mike Machuidel | last post by:
Hi, I'm a game developer programming mostly in C and ASM for about 7 years. Today at work a colleague (a C++ programmer) yelled at me I'm a bad C programmer because I use "return(0);" instead...
16
by: Esteban404 | last post by:
I have a Winform news kiosk app which connects to a SQL database. When the main form is running, it reaches a threshold time or number of sequential operations and then loads another instance with...
1
by: Me, Myself, and I | last post by:
First off, i apologize if my terminology is off... I am currently in a project that is basically a front-end to a database. In coding this, I am taking into account that it has the *potential*...
10
by: --------- | last post by:
What is the use of (return ) statment in functions? in fact i have got mess with function can't catch it feel lost?
5
by: vsteshenko | last post by:
Hello, This is my second post to the any usernet group and the first one was posted to the wrong one. I am currently working on creating an order form for sales associates at my work to be used...
4
by: huzzaa | last post by:
I am using a switch statement that will decide from a random number what message to display. I want the random number to be between 0 and 100 and then if the number is say between 1 and 10 to...
1
by: zeebiggie | last post by:
Good morning I have a form with the controls in the insert statment below. table1 has an Auto increment primary key hence is omitted in the insert statment and form. Am getting the error It didnt...
1
by: smartic | last post by:
I need to use this string "preg_match('$pattern','$value')" to return boolean value in if statment how can i do that i used eval function put it give me this error (Parse error: syntax error,...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.