AdsCommand.Parameters

Advantage .NET Data Provider

  Previous topic Next topic  

Provides access to the AdsParameter collection associated with the AdsCommand object.

public AdsParameterCollection Parameters {get;}

Remarks

The parameter collection is empty by default. The Advantage .NET Data Provider supports both named and unnamed parameters. Named parameters consist of a colon followed by a valid identifier (e.g., :value). Unnamed parameters consist of a question mark.

Example

This example executes a statement with a single parameter.

AdsConnection conn = new AdsConnection( "data source = c:\\data;" );

AdsCommand cmd;

AdsParameter prm;

 

// open the connection

conn.Open();

// create a new command object

cmd = new AdsCommand( "", conn );

// specify a statement

cmd.CommandText = "select [last name] from employee " +

"where [employee number] = :empid";

 

// create a parameter and put it in the collection

prm = cmd.CreateParameter();

prm.Value = 94;

cmd.Parameters.Add( prm );

 

// dump the first row/column of the table

Console.WriteLine( cmd.ExecuteScalar().ToString() );

// close the connection.

conn.Close();

See Also

AdsCommand.CreateParameter