Navigation:  Advantage .NET Data Provider > AdsCommand Class > AdsCommand Constructors >

AdsCommand Constructor( string, AdsConnection )

Advantage .NET Data Provider

Previous pageReturn to chapter overviewNext page

Initializes a new instance of an AdsCommand object with an SQL statement, stored procedure name or table name and the AdsConnection object.

public AdsCommand( string cmdText, AdsConnection connection );


This constructor accepts an SQL command, stored procedure name, or table name and initializes the command text with the given informaiton. It also accepts an AdsConnection object with which to associate the command object.


// create a connection object

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

AdsCommand cmd;


// open the connection


// create a new command object and give the command and connection

cmd = new AdsCommand( "select now() from system.iota", conn );

// execute the query

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

// close the connection.


See Also