i share my pics and my problem: https://imgur.com/a/poes3vI
I have a loop (pic2) in which i need read the some data link to my id….
However… the function works but during longer loops after a while it return as too many connection; in clients connection page (pic1) i saw that the previous query weren’t disposed but i think my code (pic 3-4) is correct…
my co-worker suggested me to read it in one query through inner join, but i prefer to find another way for 2 reason:
- my way of code is to make a query and load the records as custom class in a list and i would have to navigate directly in datatable and it’ll be messy
-i have to read external data for a lot of field and one-shot query will be messy and hard to manage for other people
any idea? thk for reading
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
God that’s old school =) You’re not closing the data reader. Also please use
using to avoid this eye sore. You can find a textbook example at https://docs.microsoft.com/en-us/dotnet/api/system.data.odbc.odbcdatareader?view=dotnet-plat-ext-5.0 .