Doug Wilson
Jun 21, 2023

--

Great article, as usual. Thanks for your detailed and complete treatment of this important topic as well as for the links to external articles, etc. Very helpful, useful, and valuable.

I have one suggestion to offer.

I realize that this is just example code, but I find the error description above quite misleading. I'd flag it in a code review.

This code could fail when creating the SqlConnection due to an invalid connection string or when creating the SqlCommand due to invalid SQL syntax, i.e. before the SQL is executed.

Inaccurate error messages often result in wasted time and effort in root cause analysis. Much better to point people in the right direction.

--

--

Doug Wilson
Doug Wilson

Written by Doug Wilson

Doug Wilson is an experienced software application architect, music lover, problem solver, former film/video editor, philologist, and father of four.

No responses yet