Hi,
I'm having problem with database connection in my asp.net
application. It's some kind of mistery. It
throws "ExecuteReader requires an open and available
Connection. The connection's current state is Closed. "
exception some times. I'm sure that in my code everything
fine and my connection is open. If I refresh the page
after this error pups up, it gets back to normal.

Some time ago I came accross KB article stating that this
is microsoft BUG, but it's not there anymore.

Does any one know what might be wrong. I'm using SQL
server as database.

Thank you

Lyuba

Re: ExecuteReader requires an open and available Connection. The connection's curren by David

David
Tue Sep 02 16:30:41 CDT 2003


"Lyuba" <ldubovis@hotmail.com> wrote in message
news:03e301c37198$a35c9ff0$a401280a@phx.gbl...
> Hi,
> I'm having problem with database connection in my asp.net
> application. It's some kind of mistery. It
> throws "ExecuteReader requires an open and available
> Connection. The connection's current state is Closed. "
> exception some times. I'm sure that in my code everything
> fine and my connection is open.

Well we aren't so sure.
Perhaps you could develop a little test case that demonstrates the problem.


David



Re: ExecuteReader requires an open and available Connection. The connection's curren by William

William
Tue Sep 02 17:48:50 CDT 2003

Lyuba:

It could be a bug, but that'd be the last thing I'd look at. Right before
you fire your ExecuteReader Code, try a if (myConn.State <>
ConnectionState.Open){cn.Open();} There are a lot of places that you could
declare a connection and open it, then depending on how you handle post
backs, a post back could occur and it could be closed. Another thing that
could be happening is that Another reader is holding that connection and the
other reader isn't closed yet.

I'd exhaust these paths before looking at the bug angle b/c at least in my
experience, I have code that executes readers in ASP.NET thousands of times
a day on average , seen it under 1.0 and 1.1, and never had a problem that I
didn't accidentally cause.

Have you stepped through it with the debugger btw? If not, check the
connection.state beforehand.

Good Luck,

Bill
"Lyuba" <ldubovis@hotmail.com> wrote in message
news:03e301c37198$a35c9ff0$a401280a@phx.gbl...
> Hi,
> I'm having problem with database connection in my asp.net
> application. It's some kind of mistery. It
> throws "ExecuteReader requires an open and available
> Connection. The connection's current state is Closed. "
> exception some times. I'm sure that in my code everything
> fine and my connection is open. If I refresh the page
> after this error pups up, it gets back to normal.
>
> Some time ago I came accross KB article stating that this
> is microsoft BUG, but it's not there anymore.
>
> Does any one know what might be wrong. I'm using SQL
> server as database.
>
> Thank you
>
> Lyuba



Re: ExecuteReader requires an open and available Connection. The connection's curren by Lyuba

Lyuba
Wed Sep 03 09:48:16 CDT 2003

Thank you for your reply.
I'll try these.
>-----Original Message-----
>Lyuba:
>
>It could be a bug, but that'd be the last thing I'd look
at. Right before
>you fire your ExecuteReader Code, try a if (myConn.State
<>
>ConnectionState.Open){cn.Open();} There are a lot of
places that you could
>declare a connection and open it, then depending on how
you handle post
>backs, a post back could occur and it could be closed.
Another thing that
>could be happening is that Another reader is holding that
connection and the
>other reader isn't closed yet.
>
>I'd exhaust these paths before looking at the bug angle
b/c at least in my
>experience, I have code that executes readers in ASP.NET
thousands of times
>a day on average , seen it under 1.0 and 1.1, and never
had a problem that I
>didn't accidentally cause.
>
>Have you stepped through it with the debugger btw? If
not, check the
>connection.state beforehand.
>
>Good Luck,
>
>Bill
>"Lyuba" <ldubovis@hotmail.com> wrote in message
>news:03e301c37198$a35c9ff0$a401280a@phx.gbl...
>> Hi,
>> I'm having problem with database connection in my
asp.net
>> application. It's some kind of mistery. It
>> throws "ExecuteReader requires an open and available
>> Connection. The connection's current state is Closed. "
>> exception some times. I'm sure that in my code
everything
>> fine and my connection is open. If I refresh the page
>> after this error pups up, it gets back to normal.
>>
>> Some time ago I came accross KB article stating that
this
>> is microsoft BUG, but it's not there anymore.
>>
>> Does any one know what might be wrong. I'm using SQL
>> server as database.
>>
>> Thank you
>>
>> Lyuba
>
>
>.
>