共用方式為


DacException Class

The DacException class is a generic exception that is raised when an error occurs using the Microsoft.SqlServer.Management.Dac namespace.

Inheritance Hierarchy

Object
  Exception
    Microsoft.SqlServer.Management.Common.SqlServerManagementException
      Microsoft.SqlServer.Management.Dac.DacException
        Microsoft.SqlServer.Management.Dac.BacpacException
        Microsoft.SqlServer.Management.Dac.DacExtractionException
        Microsoft.SqlServer.Management.Dac.DeploymentValidationException
        Microsoft.SqlServer.Management.Dac.ExtractValidationException
        Microsoft.SqlServer.Management.Dac.InvalidInputException

Namespace:  Microsoft.SqlServer.Management.Dac
Assembly:  Microsoft.SqlServer.Management.Dac (in Microsoft.SqlServer.Management.Dac.dll)

Syntax

'宣告
<SerializableAttribute> _
Public Class DacException _
    Inherits SqlServerManagementException
'用途
Dim instance As DacException
[SerializableAttribute]
public class DacException : SqlServerManagementException
[SerializableAttribute]
public ref class DacException : public SqlServerManagementException
[<SerializableAttribute>]
type DacException =  
    class
        inherit SqlServerManagementException
    end
public class DacException extends SqlServerManagementException

The DacException type exposes the following members.

Constructors

  Name Description
Public method DacException() Initializes a new instance of the DacException class.
Public method DacException(String) Initializes a new instance of the DacException class that has the specified message text.
Protected method DacException(SerializationInfo, StreamingContext) Initializes a new instance of the DacException class specifying a location to stream serialized information.
Public method DacException(String, Exception) Initializes a new instance of the DacException class that has the specified message text and inner exception.

Top

Properties

  Name Description
Public property DacExceptionType Gets the type of the exception.
Public property Data (Inherited from Exception.)
Public property HelpLink Gets a string with the URL help link that further explains the exception. (Overrides ExceptionHelpLink().)
Protected property HResult (Inherited from Exception.)
Public property InnerException (Inherited from Exception.)
Public property Message (Inherited from Exception.)
Protected propertyStatic member ProdVer Gets the product version.
Public property Source (Inherited from Exception.)
Public property StackTrace (Inherited from Exception.)
Public property TargetSite (Inherited from Exception.)

Top

Methods

  Name Description
Public method Equals (Inherited from Object.)
Protected method Finalize (Inherited from Object.)
Public method GetBaseException (Inherited from Exception.)
Public method GetHashCode (Inherited from Object.)
Public method GetObjectData (Inherited from Exception.)
Public method GetType (Inherited from Exception.)
Protected method Init Initializes provider properties.
Protected method MemberwiseClone (Inherited from Object.)
Protected method SetHelpContext Sets the help context for the help link.
Public method ToString (Inherited from Exception.)

Top

Remarks

Using the DacException class, you can:

Thread Safety

Any public static (Shared in Microsoft Visual Basic) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe.

Examples

VC#

try 
{ 
    //Enter DAC code here. 
 
} 
//Catch the DAC exception.
catch (DacException dacex) 
{ 
    System.Console.WriteLine("This is a DAC Exception"); 
   //Display the DAC exception message and type. 
   System.Console.WriteLine(dacex.Message); 
   System.Console.WriteLine(dacex.DacExceptionType); 
} 
   //Catch other non-DAC exceptions. 
catch (Exception ex) 
{ 
   System.Console.WriteLine("This is not a DAC exception."); 
} 

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Microsoft.SqlServer.Management.Dac Namespace

Other Resources

Handling SMO Exceptions