ExecuteScalar Method (MySqlConnection, String, MySqlParameter[])

MySQL Connector/Net

Execute a single command against a MySQL database.

Namespace:  MySql.Data.MySqlClient
Assembly:  MySql.Data (in MySql.Data.dll) Version: 6.2.2.0

Syntax

C#
public static Object ExecuteScalar(
	MySqlConnection connection,
	string commandText,
	params MySqlParameter[] commandParameters
)
Visual Basic (Declaration)
Public Shared Function ExecuteScalar ( _
	connection As MySqlConnection, _
	commandText As String, _
	ParamArray commandParameters As MySqlParameter() _
) As Object
Visual C++
public:
static Object^ ExecuteScalar(
	MySqlConnection^ connection, 
	String^ commandText, 
	... array<MySqlParameter^>^ commandParameters
)

Parameters

connection
Type: MySql.Data.MySqlClient..::.MySqlConnection
MySqlConnection object to use
commandText
Type: System..::.String
Command text to use for the command
commandParameters
Type: array< MySql.Data.MySqlClient..::.MySqlParameter >[]()[]
Parameters to use for the command

Return Value

The first column of the first row in the result set, or a null reference if the result set is empty.

See Also