ExecuteScalar does not close connection

Topics: Data Access Application Block
Jun 17, 2009 at 5:10 PM

Hi,

I use the Data Access Block and I noticed that the database connection is closed after using a DataReader, but not after getting a scalar (with ExecuteScalar). Why is that? Won't the connection be left hanging?

Thanks.

Jun 18, 2009 at 11:03 AM
Edited Jun 18, 2009 at 11:03 AM

Hi,

How did you use the ExecuteScalar method? Can you post your code? I just tried it and the connection is closed after the call to ExecuteScalar.

Valiant Dudan
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Jun 18, 2009 at 4:02 PM

It's not possible to close the connection before returning a datareader, may I also ask how did you determine the state of the connection?

 

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com