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
參數
- connection
型別:Microsoft.SqlServer.Management.Common.ServerConnection
The server connection.
- script
型別:System.String
A string value of the script.
傳回值
型別: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.