CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums

ASP.NET Web Hosting
Microsoft Gold Certified Partner – 3 Months Free and Free Setup



Can Reply:  No Members Can Edit: No Online: Yes
Zone: > NEWSGROUP > Asp.Net Forum > starter_kits_and_source_projects.commerce_starter_kit Tags:
Item Type: NewsGroup Date Entered: 1/12/2004 9:44:43 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
NR
XPoints: N/A Replies: 1 Views: 19 Favorited: 0 Favorite
2 Items, 1 Pages 1 |< << Go >> >|
Plato2
Asp.Net User
When we call a method from a class that opens a connection and connection is never closed so what's happeneing with connection?1/12/2004 9:44:43 PM

0

When we call a method from a class that opens a connection and returns a DataReader after we used a DataReader what's happen with connection that is open?

For Example:
---------------------------------------------
public SqlDataReader GetProductCategories()
{

// Create Instance of Connection and Command Object
SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
SqlCommand myCommand = new SqlCommand("ProductCategoryList", myConnection);

// Mark the Command as a SPROC
myCommand.CommandType = CommandType.StoredProcedure;

// Execute the command
myConnection.Open();
SqlDataReader result = myCommand.ExecuteReader(CommandBehavior.CloseConnection);

// Return the datareader result
return result;
}
--------------------------------------------------------------------------
Connection is never Closed so what is happening with the connection?

Thank you,Alex
shmacgregor
Asp.Net User
Re: When we call a method from a class that opens a connection and connection is never closed so what's happeneing with connection?1/14/2004 4:22:51 AM

0

You should always close the connection along with the Reader.

myConnection.Open();
SqlDataReader result = myCommand.ExecuteReader(CommandBehavior.CloseConnection);
myConnection.Close();

If you don't close it, depending upon your configuration, the connection times out or stays open. If open, it may cause problems if you try to open another connection.
Sandy

2 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:

Web:
MySQL Connection Management in PHP - How (Not) To Do Things - Jay ... So, when would we call this function? Well, if you were paying attention earlier , .... That way, if you open up a connection in the header, you don't end up ...
MySQL :: MySQL 6.0 Reference Manual :: 19.4.5.2 Using Connector/J ... Using a connection pool with a J2EE application server ... that weren't * explicitly closed during normal code path, so * that we don't 'leak' resources. ...
cURL - Internal Design If the cache is full already when we add a new connection, we close one of the ... In aiding the user to understand what's happening and to debug curl usage ...
Davis Freeberg’s Digital Connection » Blog Archive » DivX In The ... Dec 14, 2006 ... Which is to say we do better in open vs. closed, so if it’s more open like a ..... Davis Freeberg’s Digital Connection is proudly powered by ...
Frank Kieviet : Weblog It will return the real jms connection/session pair back to the pool and it will mark the session that the application sees (variable s) as closed, so that ...
Angel Saenz-Badillos : Connection Pooling and the "Timeout expired ... Close(); //We are calling connection close, and we are still leaking connections ... Fairly straightforward, if you turn pooling off you will never hit the ...
Thomas Hawk's Digital Connection Silencing your critics is never a good idea whether you have the power to do so or not. What's more the group was shut down without any warning or ...
Mailing list archives We still close out a connection if at release if it wasn't passed in via ... I can imagine the scope being > that of a method call to the control (each ...
Connection Cafe - A nonprofit technology and online philanthropy ... So, alas…we’re giving this one to McCain for clear interactive ..... This is a Flickr badge showing public photos and videos from Connection Cafe blog. ...
PHP: mysql_pconnect - Manual mysql_pconnect — Open a persistent connection to a MySQL server .... And, transactions that were never closed by code (user went out to lunch and got hit by ...

Videos:
Lec 36 | MIT 8.02 Electricity and Magnetism, Spring 2002 Farewell Special Bring a Friend! View the complete course: http://ocw.mit.edu/8-02S02 License: Creative Commons BY-NC-SA More information at http:/...
Marco Borrillo vs. Robert Bryant Jr. - Arizona Open Singles RR - Table Tennis Marco Borrillo vs. Robert Bryant Jr. - Arizona Open Singles RR - Table Tennis Ping Pong Tournament Arizona Online - Desert Table Tennis Outpost htt...
Human Computation Google TechTalks July 26, 2006 Luis von Ahn is an assistant professor in the Computer Science Department at Carnegie Mellon University, where he als...
Farmers' Almanac TV: LUMBERJACKS & “HIGH-RAILERS” Episode 107 In Part One of Wisconsin’s International Lumberjack Championship, 8- to 80 year-olds compete to be World Champions. Follow the adventures...
WCN # 174 - World Chess News - ( Mitt i Schack ) This episode contains of: * Ivanchuk new World Champion in Blitz Chess * Kramnik won Tal Memorial * Chess records during the centuries * Chesshisto...
VideoSource Alaska A comprehensive program on the State of Alaska. We visit every region of this great state, exploring the indigenous cultures and wildlife, and parti...
Google Famia Nkansa performs a spoken word poem at Stanford University before an audience of students and poets.
From the Himalayas to Jerusalem Hidabroot מההימליה לירושלים hidabroot movie series. Rabbi Yitzhak Fanger went from being the number one Reiki instructor in Israel to an orthodox rabbi. Yitzhak Fanger studied ...
Charlie Rose - Guest Host Dr. Harold Varmus with neurobiologist Dr. Eric Kandel Nobel laureate Dr. Harold Varmus, Chairman & CEO of Memorial Sloan-Kettering Cancer Center, serves as guest host for this conversation with neurobiol...
Charlie Rose - 50th Anniversary of the Asia Society An hour at the Asia Society with philanthropist and art collector David Rockefeller and the president of the Asia Society, Vishakha Desai. David Roc...












what happened to the c# samples?

the communitystarterkits can not use a database located on another server machine

ibuyspy store hosting problem

why am i getting a nullreferenceexception?

pls help ......

sqldatetime overflow. must be between 1/1/1753 12:00:00 am and 12/31/9999 11:59:59 pm

use an other dbms than sql server

any step by step for cc processing?

commerce starter kid upgraded–free production site

¿ how i can program commercestarterkit .net 2.0's web services api ?

microsoft development environment error?

problems with commerce starter kit??!!??

configuration error (iis related?) but i want to use cassini

server error in '/' application

syntax error in store procedure

does the ibuyspy store still exists for downloading?

using the commerce start kit on godaddy.com

problem with starter kit- can not compile anything!

download ibuyspy?

iis

parser error message: could not load type 'aspnet.starterkit.commerce.global'

no db connection when installing starter kit

minor redundancy spotted

admin interface

advice needed, vbsdk or vbvs

commerce starter kit installation problem

asp.netcommerce starter kit, how do i open in visual studio.

about n tier design in the kit

currency picker

new page questions

   
  Privacy | Contact Us
All Times Are GMT