Answers for "exception errors c#"

C#
0

how to get error code from exception in c#

try {
	// some operation causing an exception
}
catch (SqlException e) {
	if (e.ErrorCode == 0x80131904)
      	// ...
		return null;
	throw;
}
Posted by: Guest on March-25-2021
0

exception in asp.net c#

try
{
    //code that may raise an exception
}
catch //cannot have both catch and catch(Exception ex)
{ 
    Console.WriteLine("Exception occurred");
}
catch(Exception ex) //cannot have both catch and catch(Exception ex)
{
    Console.WriteLine("Exception occurred");
}
Posted by: Guest on October-31-2020
0

exception in asp.net c#

try
{
    // put the code here that may raise exceptions
}
catch
{
    // handle exception here
}
finally
{
    // final cleanup code
}
Posted by: Guest on October-31-2020

C# Answers by Framework

Browse Popular Code Answers by Language