共用方式為


EnumHistory 方法

Enumerates a list of execution history associated with the referenced job.

命名空間:  Microsoft.SqlServer.Management.Smo.Agent
組件:  Microsoft.SqlServer.Smo (在 Microsoft.SqlServer.Smo.dll 中)

語法

'宣告
Public Function EnumHistory As DataTable
'用途
Dim instance As Job
Dim returnValue As DataTable

returnValue = instance.EnumHistory()
public DataTable EnumHistory()
public:
DataTable^ EnumHistory()
member EnumHistory : unit -> DataTable 
public function EnumHistory() : DataTable

傳回值

型別:System.Data. . :: . .DataTable
A DataTable object value that contains execution history data for the referenced job.

範例

The following code example creates a job then displays its execution history.

C#

Server srv = new Server("(local)");
Job jb = srv.JobServer.Jobs["Test Job"];
DataTable jobHistory = jb.EnumHistory();

PowerShell

$srv = new-object Microsoft.SqlServer.Management.Smo.Server("(local)")
$jb = $srv.JobServer.Jobs["Test Job"]
$jobHistory = $jb.EnumHistory()