Interpreting an Interop error code using SQL-DMO

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • holysmokes99

    #1

    Interpreting an Interop error code using SQL-DMO

    I have a VB.Net (1.1) that uses SQL-DMO via COM Interop to create a
    linked server. The code throws an exception, as it should, when the
    linked server I am trying to create already exists on the server. If I
    were coding this directly in ADO.Net, then the excerption thrown would
    be a SQLException which I could catch and read the errorcode, which
    would tell me that the error is "linked server already exists".
    However, the error thrown is a
    System.Runtime. InteropServices .COMException with an errorcode of
    -2147206476. Is it safe for me to assume that this error code is always
    the same for a linked server already existing, or is this just a
    generic COMexception error code?

    Thanks,
    Marcus

Working...