다음을 통해 공유


ExecuteScalar 메서드

Executes the query, and returns the first column of the first row in the result set returned by the query. Additional columns or rows are ignored. 코드에서 직접 이 멤버를 참조하면 안 됩니다. 이 방법은 SQL Server 인프라를 지원합니다.

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

구문

‘선언
Public Shared Function ExecuteScalar ( _
    connection As ServerConnection, _
    script As String _
) As Object
‘사용 방법
Dim connection As ServerConnection
Dim script As String
Dim returnValue As Object

returnValue = SfcTSqlExecutor.ExecuteScalar(connection, _
    script)
public static Object ExecuteScalar(
    ServerConnection connection,
    string script
)
public:
static Object^ ExecuteScalar(
    ServerConnection^ connection, 
    String^ script
)
static member ExecuteScalar : 
        connection:ServerConnection * 
        script:string -> Object 
public static function ExecuteScalar(
    connection : ServerConnection, 
    script : String
) : Object

매개 변수

반환 값

유형: System. . :: . .Object
The first column of the first row in the result set, or a null reference if the result set is empty. Returns a maximum of 2033 characters.