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.