vb.net

  • Thread starter Thread starter anu jyala via .NET 247
  • Start date Start date
A

anu jyala via .NET 247

(Type your message here)
hello,
i'm using fill method to populate.and fill method implicitlyopen and close the executereader connection. and my question iswhy the error occured"there is already an open datareaderassociated with this connection which must be closed first" only inside the combobox selectedindexevent and textchangedevent.? when i call this parameterized querry inside any otherevent's as keyevent,click event it work's succesfully? how can icorrect it?if the existing connection is there how can i closeit?
 
It would help if you post the code, but it's most likely that the connection
isn't getting closed. If you are raising and eating an exception, then you
can't be sure the connection is being closed. First, make sure you're using
a Finally block (or if you are using vb.net 2005 - then the Using Statement)
that contains the close statement. Make sure that you close the reader
(preferably using the CloseConnection enumeration) just to be safe. Then
you may want to check the ConnectionState property before attempting to open
the connection. If the connection is already open (just temporarily until
you track it down) then just cloes it and reopen it again (this is not a
long term fix but will help to first prove which connection it is and then
allow it to work so you can step through and track it down.

there's almost always smoke where there's fire with that exception
message....If you post the code involved, I can probably help you nail it
down.

Cheers,

Bill

--
W.G. Ryan MVP (Windows Embedded)

TiBA Solutions
www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com
(Type your message here)
hello,
i'm using fill method to populate.and fill method implicitly open and
close the executereader connection. and my question is why the error
occured"there is already an open datareader associated with this connection
which must be closed first" only inside the combobox selectedindexevent
and textchanged event.? when i call this parameterized querry inside any
other event's as keyevent,click event it work's succesfully? how can i
correct it?if the existing connection is there how can i close it?
 
Back
Top