Possible Sql server timeout and objects all the same RRS feed

  • Question

  • My little project.  Two ListBox's each with 1 column.  Both filled from different tables (4 rows, 3 columns).  Moving one or more items from one Listbox to the other (one table to the other)  In between reading reading from each table I create 4 class objects, one for each table row.  What I found is although its creating the 4 objects, they all have the same values, row 4 in table1.  I then checked the SqlDataReader, on first look, I see the 4 data sets, the first the same as the first row in the table1.  A few seconds later, Enumeration yielded no results.  I thought this was an issue with IEnumerable not reading the DataReader, then someone suggested a sql connection timeout.  That could be the problem, but it doesn't explain why the 4 objects are the same as the last row and not all different.  How do I prevent a connection timeout if that's all or part of the issue?   
    Thursday, August 29, 2019 4:34 PM

All replies

  • Figured out why the objects were all the same, the class members were static.  I remove the static and solved that issue, all objects are different.  No idea what's causing the Enumerator yielded no results. Apparently the Community developers are not overly concerned about it either.  
    Friday, August 30, 2019 12:31 AM
  • Hi RichardDunneBSc,

    I'm glad to hear that you have solved it.

    For "Enumerator yielded no results", the sql connection timeout is to save system resource, and maybe you could also refer this similar thread, hope it could help you.

    Best Regards,


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Friday, August 30, 2019 4:24 AM