Setting database parameters

Specifying parameters for most drivers

In code, for most drivers you set the parameters using the DbParameter property of the Transaction or AdoTransaction object. The examples use SQLCA as the name of the transaction object and show Visual Basic syntax. For C#, add a semicolon to the end of the statement.

Specifying parameters for ADO.NET and AdoTransaction

When you use an AdoTransaction object with the ADO.NET driver, you specify parameters in the ConnectionString property of the Connection object, for parameters that apply to the connection, or in an argument passed to the AdoTransaction object.

The examples for each parameter do not show this syntax, but you can use the Preview page of the Database Profile dialog box to create the code for you. The following Visual Basic and C# examples show the code generated when a few parameters have been set.

[Visual Basic]
Dim theConnection As New System.Data.OleDb.OleDbConnection

theConnection.ConnectionString = "Data Source=EASDemoDB;Provider=ASAProv.90;Initial Catalog=easdemodb105;User ID=dba;Password=****;"

theConnection.Open()

Dim SQLCA As New Sybase.DataWindow.AdoTransaction(theConnection, "DelimitIdentifier='Yes',OJSyntax='ANSI'")

SQLCA.BindConnection()

[C#]
System.Data.OleDb.OleDbConnection theConnection = new System.Data.OleDb.OleDbConnection();

theConnection.ConnectionString = "Data Source=EASDemoDB;Provider=ASAProv.90;Initial Catalog=easdemodb105;User ID=dba;Password=****;";

theConnection.Open();

Sybase.DataWindow.AdoTransaction SQLCA = new Sybase.DataWindow.AdoTransaction(theConnection, "DelimitIdentifier='Yes',OJSyntax='ANSI'");

SQLCA.BindConnection();