문서를 영문으로 보려면 영문 확인란을 선택하세요. 마우스 포인터를 텍스트 위로 이동시켜 팝업 창에서 영문 텍스트를 표시할 수도 있습니다.
번역
영문
Visual Studio 2017을 사용하는 것이 좋습니다.

Server.EnumActiveCurrentSessionTraceFlags 메서드

Gets active session flags as a DataTable.

네임스페이스:  Microsoft.SqlServer.Management.Smo
어셈블리:  Microsoft.SqlServer.Smo(Microsoft.SqlServer.Smo.dll)

public DataTable EnumActiveCurrentSessionTraceFlags()

반환 값

유형: System.Data.DataTable
An object of type DataTable representing one table of in-memory data.

The following sample shows how to use this feature in C#:

// compile with: /r:Microsoft.SqlServer.Smo.dll /r:Microsoft.SqlServer.Management.Sdk.Sfc.dll /r:Microsoft.SqlServer.ConnectionInfo.dll /r:System.Data.dll

using System;
using System.Data;
using System.Text;
using Microsoft.SqlServer.Management.Smo;


public class A {
   public static void Main() {
      Server svr = new Server();

      // Turning on a trace flag
      svr.Databases["master"].ExecuteNonQuery("DBCC TRACEON (3205,-1)");

      // enumeratiung through the active trace flags in the current session
      DataTable dt = svr.EnumActiveCurrentSessionTraceFlags();

      // Reading the datatable returned
      Console.WriteLine("ROWCOUNT = " + dt.Rows.Count);


      foreach (DataRow row in dt.Rows) {
         StringBuilder record = new StringBuilder();
         foreach (DataColumn col in dt.Columns) {
            record.Append(col.ColumnName + "=" + row[col.ColumnName] + "  ");
         }
         Console.WriteLine(record);
      }
   }
}

The following sample shows how to use this feature in Visual Basic:

' compile with: /r:Microsoft.SqlServer.Smo.dll /r:Microsoft.SqlServer.Management.Sdk.Sfc.dll /r:Microsoft.SqlServer.ConnectionInfo.dll /r:System.Data.dll
Imports System.Data
Imports System.Text
Imports Microsoft.SqlServer.Management.Smo

Public Class A
   Public Shared Sub Main()
      Dim svr As New Server()

      ' Turning on a trace flag
      svr.Databases("master").ExecuteNonQuery("DBCC TRACEON (3205,-1)")

      ' enumeratiung through the active trace flags in the current session
      Dim dt As DataTable = svr.EnumActiveCurrentSessionTraceFlags()

      ' Reading the datatable returned
      Console.WriteLine("ROWCOUNT = " & dt.Rows.Count)


      For Each row As DataRow In dt.Rows
         Dim record As New StringBuilder()
         For Each col As DataColumn In dt.Columns
            record.Append(col.ColumnName & "=" & Convert.ToString(row(col.ColumnName)) & "  ")
         Next
         Console.WriteLine(record)
      Next
   End Sub
End Class

커뮤니티 추가 항목

추가
표시: