ReadErrorLog 메서드
SQL Server 오류 로그를 열거합니다.
네임스페이스: Microsoft.SqlServer.Management.Smo
어셈블리: Microsoft.SqlServer.Smo(Microsoft.SqlServer.Smo.dll)
구문
‘선언
Public Function ReadErrorLog As DataTable
‘사용 방법
Dim instance As Server
Dim returnValue As DataTable
returnValue = instance.ReadErrorLog()
public DataTable ReadErrorLog()
public:
DataTable^ ReadErrorLog()
member ReadErrorLog : unit -> DataTable
public function ReadErrorLog() : DataTable
반환 값
유형: System.Data. . :: . .DataTable
SQL Server 오류 로그의 열거된 오류 목록을 포함하는 StringCollection 시스템 개체 값입니다.
예
C#
Server srv = new Server("(local)");
DataTable d = srv.ReadErrorLog();
foreach (DataRow r in d.Rows)
{
Console.WriteLine("============================================");
foreach(DataColumn c in d.Columns)
{
Console.WriteLine(c.ColumnName + " = " + r[c].ToString());
}
}
PowerShell
$srv = new-Object Microsoft.SqlServer.Management.Smo.Server("(local)")
$d = $srv.ReadErrorLog()
foreach ($r in $d.Rows)
{
Write-Host "============================================"
Foreach ($c in $d.Columns)
{
Write-Host $c.ColumnName "=" $r[$c]
}
}