none
SqlException.Number - list of numbers and meanings (53 and 67)? RRS feed

  • Question

  • I'm working on some C# code. It calls upon class SqlException.Number property (int32 - Type of error). This is different from the Errorcode property. I need a list of the values and the meaning for each. I need to reference an official MS source of the info, so just giving me the two values won't help.

    Thanks.

    Wednesday, February 1, 2012 5:01 PM

Answers

All replies

  • Hi,

    You can find all error numbers at here: http://msdn.microsoft.com/en-us/library/cc645603.aspx there are lot there. If you click on the error number, you may get detailed explanation for some of them.

    I hope it helps.

    J.


    There are 10 type of people. Those who understand binary and those who do not.
    My Blog
    Wednesday, February 1, 2012 5:09 PM
  • Hi,

    You can find all error numbers at here: http://msdn.microsoft.com/en-us/library/cc645603.aspx there are lot there. If you click on the error number, you may get detailed explanation for some of them.

    I hope it helps.

    J.


    There are 10 type of people. Those who understand binary and those who do not.
    My Blog
    No, I checked that before i asked my question. The number 53 is there, but not the 67, and recall that this is a "type of error" as the documentation on the SqlException class describes for the  number property. There must be another answer to this question.
    Wednesday, February 1, 2012 7:56 PM
  • Hi cobracus,

    Welcome to MSDN Forum.

    Janos's link provide all of the error numbers, I think '67' may not the SQL Server error number, have you meet the error?

    Best Regards


    Allen Li [MSFT]
    MSDN Community Support | Feedback to us
    Friday, February 3, 2012 2:36 AM
    Moderator
  • Hi cobracus,

    Welcome to MSDN Forum.

    Janos's link provide all of the error numbers, I think '67' may not the SQL Server error number, have you meet the error?

    Best Regards


    Allen Li [MSFT]
    MSDN Community Support | Feedback to us

    As I explained in the first post: I am working on code that performs an action if the number is 67. But there is no documentation as to why that action is taken. So the meaning of the value 67 must be found.

    And again. the property SqlException.Number is an "ERROR TYPE" code and not an error code in itself.

    Friday, February 3, 2012 4:59 AM
  • Hi cobracus,

    I've searched for a long time, but still can't find a SqlException.Number valued 67. I will do more research and if I find it, I will come back as soon as possible.

    Best Regards


    Allen Li [MSFT]
    MSDN Community Support | Feedback to us
    Monday, February 6, 2012 8:10 AM
    Moderator
  • Hi cobracus,

    I've searched for a long time, but still can't find a SqlException.Number valued 67. I will do more research and if I find it, I will come back as soon as possible.

    Best Regards


    Allen Li [MSFT]
    MSDN Community Support | Feedback to us
    Yes, I have also searched for a long time. I just don't know where else I can find this information. I also don't understand why it should be so hard to find. Please do let me know if you come across it. Thank you for your effort.
    Monday, February 6, 2012 3:29 PM
  • Hi cobracus,

    67 is not a sql error code, it is a system error code, it means the network name cannot be found. Below is the link which I found the error code.

    http://msdn.microsoft.com/en-us/library/windows/desktop/ms681382(v=vs.85).aspx

    I hope it could help.

    Best Regards


    Allen Li [MSFT]
    MSDN Community Support | Feedback to us

    Monday, February 13, 2012 7:51 AM
    Moderator
  • Hi cobracus,

    67 is not a sql error code, it is a system error code, it means the network name cannot be found. Below is the link which I found the error code.

    http://msdn.microsoft.com/en-us/library/windows/desktop/ms681382(v=vs.85).aspx

    I hope it could help.

    Best Regards


    Allen Li [MSFT]
    MSDN Community Support | Feedback to us

    I think I said that its not an error code, but I doubt that its a system error code. Can you get a system error code for SQLException.Number?? The code is below.

    protected override bool HandlePopulateDatabasesException(Exception exception)
            {
                SqlException sqlException = exception as SqlException;
                
                if (sqlException.Number == 67)
                {
                    DatabaseDriver.RemoveDatasource(Name);
                    MessageBox.Show("Error while trying to populate databases. " + exception.Message, DatabaseDriver.Name, MessageBoxButton.OK, MessageBoxImage.Exclamation);
                    return false;
                }
                else
                {
                    throw exception;
                }
            }
    



    • Edited by cobracus Tuesday, February 14, 2012 6:24 PM
    Tuesday, February 14, 2012 6:23 PM
  • Hi cobracus,

    I think it may cuased by some connective problem.

    Best Regards


    Allen Li [MSFT]
    MSDN Community Support | Feedback to us

    Wednesday, February 15, 2012 3:21 AM
    Moderator
  • Hi cobracus,

    All answers and information provided on this thread are incorrect or incomple.

    First the SqlException.Number property is wrapper to the FIRST SqlError.Number in the Errors collection of the exception. ( Read the Remarks section here: https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlexception.number(v=vs.110).aspx )

    So in order to get the full picture you should iterate over this collection.

    Second the "Number' property CAN contain errors other than Sql Server Error codes... For example it can contain Win32 Error Codes ( As explained here: https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlerror.number(v=vs.110).aspx   )

    Finally the error you are receiveing is "67" which is 43 in HEX which is "The network name cannot be found." "ERROR_BAD_NET_NAME".

    Allen Li got that part right..... But failed to explain that Win32 Error codes CAN be contained in a SqlError.Number.

    These 2 links provide the Win32 Error codes:

    https://msdn.microsoft.com/en-us/library/windows/desktop/ms681382(v=vs.85).aspx

    https://msdn.microsoft.com/en-us/library/cc231199.aspx


    Just trying to learn!

    • Proposed as answer by Darkonekt Saturday, July 2, 2016 4:15 PM
    Saturday, July 2, 2016 4:14 PM