troubleshooting Question

Open datareader in loop

Avatar of NoraWil
NoraWilFlag for Belgium asked on
Visual Basic.NET
6 Comments1 Solution245 ViewsLast Modified:
Hi experts,

The attached code is part of a loop. The dataadapter, dataset and datatable are declared Private at the top the module.
The fill command results in an error (in dutch) saying that there is already an open datareader connected to this command.
I don't use a datareader, but I know the fill command creates one internally.
In the same loop the dataadapter, dataset and datatable are disposed and set to nothing, but that doesnt't help.
What am I doing wrong??

Thanks in advance
daKlantgegevens = New SqlDataAdapter(strSQL, conRaptor)
dsKlantgegevens = New DataSet
daKlantgegevens.Fill(dsKlantgegevens, "Klantgegevens")
dtKlantgegevens = dsKlantgegevens.Tables("Klantgegevens")
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 6 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros