次の方法で共有


CreationDate プロパティ

パッケージが作成された日時を取得します。値の設定も可能です。

名前空間:  Microsoft.SqlServer.Dts.Runtime
アセンブリ:  Microsoft.SqlServer.ManagedDTS (Microsoft.SqlServer.ManagedDTS.dll)

構文

'宣言
Public Property CreationDate As DateTime
    Get
    Set
'使用
Dim instance As Package
Dim value As DateTime

value = instance.CreationDate

instance.CreationDate = value
public DateTime CreationDate { get; set; }
public:
property DateTime CreationDate {
    DateTime get ();
    void set (DateTime value);
}
member CreationDate : DateTime with get, set
function get CreationDate () : DateTime
function set CreationDate (value : DateTime)

プロパティ値

型: System. . :: . .DateTime
DateTime オブジェクトです。

説明

DateTime は、バリアント データ型 VT_DATE で、これは、Integration Services のデータ型 DT_Date です。この値は上書きできます。VT_DATE と DT_Date の詳細については、「Integration Services のデータ型」を参照してください。

使用例

次の例では、Samples フォルダからパッケージを読み込み、CreationDate、CreatorComputerNameCreatorName など、パッケージに関する情報を取得します。

static void Main(string[] args)
        {
            // The variable pkg points to the location
            // of the ExecuteProcess package sample 
            // that is installed with the samples.
            string pkg = @"C:\Program Files\Microsoft SQL Server\100\Samples\Integration Services\Package Samples\ExecuteProcess Sample\ExecuteProcess\UsingExecuteProcess.dtsx";

            Application app = new Application();
            Package p = app.LoadPackage(pkg, null);

            //Retrieve creation information about the package.
            DateTime createDate = p.CreationDate;
            String computerCreated = p.CreatorComputerName;
            String creatorName = p.CreatorName;

            Console.WriteLine("Package creation date = " + createDate);
            Console.WriteLine("Creation Computer = " + computerCreated);
            Console.WriteLine("Creator Name = " + creatorName);
        }
Shared  Sub Main(ByVal args() As String)
            ' The variable pkg points to the location
            ' of the ExecuteProcess package sample 
            ' that is installed with the samples.
            Dim pkg As String =  "C:\Program Files\Microsoft SQL Server\100\Samples\Integration Services\Package Samples\ExecuteProcess Sample\ExecuteProcess\UsingExecuteProcess.dtsx" 
 
            Dim app As Application =  New Application() 
            Dim p As Package =  app.LoadPackage(pkg,Nothing) 
 
            'Retrieve creation information about the package.
            Dim createDate As DateTime =  p.CreationDate 
            Dim computerCreated As String =  p.CreatorComputerName 
            Dim creatorName As String =  p.CreatorName 
 
            Console.WriteLine("Package creation date = " + createDate)
            Console.WriteLine("Creation Computer = " + computerCreated)
            Console.WriteLine("Creator Name = " + creatorName)
End Sub

サンプルの出力 :

Package creation date = 5/5/2003 5:46:00 PM

Creation Computer =

Creator Name =