Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

SqlCommand::Parameters Property

 
Namespace:   System.Data.SqlClient
Assembly:  System.Data (in System.Data.dll)

public:
property SqlParameterCollection^ Parameters {
	SqlParameterCollection^ get();
}

Property Value

Type: System.Data.SqlClient::SqlParameterCollection^

The parameters of the Transact-SQL statement or stored procedure. The default is an empty collection.

The Microsoft .NET Framework Data Provider for SQL Server does not support the question mark (?) placeholder for passing parameters to a SQL Statement or a stored procedure called by a command of CommandType.Text. In this case, named parameters must be used. For example:

SELECT * FROM Customers WHERE CustomerID = @CustomerID

System_CAPS_noteNote

If the parameters in the collection do not match the requirements of the query to be executed, an error may result.

For more information, see Configuring Parameters and Parameter Data Types.

The following example demonstrates how to create a SqlCommand and add parameters to the SqlParameterCollection.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Return to top
Show:
© 2017 Microsoft