How can I defensively code against randomly referencing “Table 0” and null values?

前端 未结 1 1714
栀梦
栀梦 2021-01-25 21:53

I am retrieving a moderate amount of data and processing it - nothing unique there. What was odd at first was that with some sets of data, it worked fine, and with others, I got

相关标签:
1条回答
  • 2021-01-25 22:26

    As jmcilhinney suggests, tweaking the CommandTimeout value seems to have been the ticket/done the trick.

    I originally made the SqlCommand's CommandTimeout value 300 (5 minutes), but with that I got "Context Switch Deadlock occurred." So I then reduced it to 120 (2 minutes), and that seems to be more or less the "sweet spot" for me. I did get "Timeout expired" one time out of several tests, but when I retried the same exact range, it completed successfully the second time, so I guess it's just "one of those things" - 120 will sometimes not be enough of a timeout, but 300 is apparently too much. IOW, this balancing act between too little and too much doesn't appear to be "an exact science."

    0 讨论(0)
提交回复
热议问题