Reader error messsage ?? Urgent..!!

G

Guest

Hi,

why i get an error as below after running the program.
"There is already an open Data Reader associated with this connection which
must be closed first."

the original code that produce the error as follow:
dim myconnec as sqlconnection = new sqlconnection("Connectionstring")
dim mycomm as sqlcommand = new sqlcommand("select * from person",myconnec)

myconnec.open()

datagrid1.datasource = mycomm.executereader(commandbehavior.closeconnection)
*this line generates the error message.

datagrid1.databind()

myconnection.close()

any ideas ?? how to solve it ?
i believe such error make me cannot rebind my datagrid content on the
frameset.htm after i update some of the data.

thanks in advance.

daniel.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,983
Messages
2,570,187
Members
46,747
Latest member
jojoBizaroo

Latest Threads

Top