A first chance exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll
I have application that is connecting to the DB and if I enter incorrect information about DB server I wait a lot of time for responce and in console (MS output) I see a lot of lines like this:
A first chance exception of type 'System.Data.SqlClient.SqlE开发者_C百科xception' occurred in System.Data.dll
How I can configure my app that it will return error after first error line : A first chance exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll
. And is it possible or I need to wait long time for exception ?
I do have same exception. But there was an issue with the permission to the target SQL database.
Just make sure the that the User mapping
to the specific user used by the application in to the database.
Just select db_owner
and public
.
Hope it works.
Just reply if it solves any body's bugs.
The wait is most likely due to the timeout values in the connection string settings. Lower those values and it will fail faster.
To avoid waiting too long you can set a ConnectTimeout of the connection object to a shorter interval.
Dont know what you mean about "return error after first error line." Can you give an example of what the full message is and what you want?
精彩评论