共用方式為


ExecuteScalar 方法 (String)

Executes a Transact-SQL statement and returns the first column of the first row as an object value.

命名空間:  Microsoft.SqlServer.Management.Common
組件:  Microsoft.SqlServer.ConnectionInfo (在 Microsoft.SqlServer.ConnectionInfo.dll 中)

語法

'宣告
Public Function ExecuteScalar ( _
    sqlCommand As String _
) As Object
'用途
Dim instance As ServerConnection
Dim sqlCommand As String
Dim returnValue As Object

returnValue = instance.ExecuteScalar(sqlCommand)
public Object ExecuteScalar(
    string sqlCommand
)
public:
Object^ ExecuteScalar(
    String^ sqlCommand
)
member ExecuteScalar : 
        sqlCommand:string -> Object 
public function ExecuteScalar(
    sqlCommand : String
) : Object

參數

傳回值

型別:System. . :: . .Object
An Object system object value that specifies the first column of the first row of the result set.

範例

呼叫方法