Quantcast
Channel: Catching Sql Expection and display in Textbox
Viewing all articles
Browse latest Browse all 4

Re: Catching Sql Expection and display in Textbox

$
0
0

Hi Maesto10,

Based on your requirement, I think you could modify your code like below:

try
{
    //Your code
}
catch(SqlException ex)
{
    MessageBox.Show("there was an issue!");
}
catch(Exception ex)
{
    MessageBox.Show("there was another issue!");
}

For more information, please refer to the following links:

SqlException Class: https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlexception(v=vs.110).aspx

SqlException.Number Property: https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlexception.number.aspx

http://stackoverflow.com/questions/19970397/c-sharp-try-catch-confusion

Best Regards,

Candice Zhou


Viewing all articles
Browse latest Browse all 4

Latest Images

Trending Articles





Latest Images