Try/Catch does not catch
问题 In following code I purposefully mistype "@fooData" to "@foo111Data" to check if the try statement is catching my exception. See below code. But the try/catch statement did not catch and display and exception in MessageBox, and VS2010 just break down and highlight the line of wrong code. try { conn.Open(); cmd.Parameters.AddWithValue("@foo111Data", dataStrTb1.Text); cmd.ExecuteNonQuery(); } catch (SqlCeException ex) { MessageBox.Show(ex.ToString()); } finally { conn.Close(); } 回答1: Perhaps an