Client Interfaces Guide > Connecting to TDV Server through ADO.NET > Sample Code for Testing of an ADO.NET Driver > About ADO.NET Placeholders
 
About ADO.NET Placeholders
The following is a sample SQL statement with a parameter that uses a placeholder:
delete from products where ProductID=@ProductID
 
In the example, @ProductID is the placeholder argument name, and the @ and ? characters are placeholders. Using ? is recommended.) The argument name must not be empty.
If the SQL statement is a prepared statement, you must bind @ProductID with a parameter object. This object contains the argument name, value and type. ADO.NET can send those values to the server to gain access to the result.
From Method A in About Using Parameters, a prepared SQL statement was used as the cmd.CommandText:
cmd.CommandText = "delete from products where ProductID=@ProductID";
 
You can bind the placeholder in the following manner:
cmd.Parameters.Add("@ProductID", CompositeDbType.INTEGER);
 
The cmd.Parameters is an object of the CompositeParameterCollection and every CompositeCommand object has a cmd.Parameters object that contains all parameters bound to the all placeholder.
You could instead use the cmd.Parameters.Add method to bind a placeholder and parameter object. Adding a parameter object to the @ProductID placeholder and defining its type as a CompositeDbType.INTEGER requires a value of the parameter like the following:
cmd.Parameters[0].Value = 1111;
 
The cmd.Parameters[0] refers to the first parameter object, with a value of 1111.