Contents Index DBConnectionContext interface DBParameterCollection class

MobiLink Synchronization User's Guide
  Writing Synchronization Scripts in .NET
    MobiLink .NET API Reference

DBParameter class


public class DBParameter
Member of iAnywhere.MobiLink.Script

Represents a bound ODBC parameter.

DBParameter is required to execute commands with parameters. All parameters must be in place before the command is executed.

For example, the following C# code uses DBCommand to execute an update with parameters:

DBCommand cstmt = conn.CreateCommand();
  cstmt.CommandText = "call myProc( ?,?,? )";
  cstmt.Prepare();
  DBParameter param = new DBParameter();
  param.DbType          = SQLType.SQL_CHAR;
  param.Value           = "10000";
  cstmt.Parameters.Add( param );
  param                 = new DBParameter();
  param.DbType          = SQLType.SQL_INTEGER;
  param.Value           = 20000;
  cstmt.Parameters.Add( param );
  param                 = new DBParameter();
  param.DbType          = SQLType.SQL_DECIMAL;
  param.Precision       = 5;
  param.Value           = new Decimal( 30000 );
  cstmt.Parameters.Add( param );
  // Execute update
  DBRowReader rset = cstmt.ExecuteNonQuery();
  cstmt.Close();
dbType property 

public SQLTYPE dbType

The value is the SQLType of this parameter.

Default: SQLType.SQL_TYPE_NULL.

Direction property 

public System.Data.ParameterDirection Direction

The value is the Input/Output direction of this parameter.

Default: ParameterDirection.Input.

IsNullable property 

public bool IsNullable

The value Indicates whether this parameter can be NULL.

Default: false.

ParameterName property 

public string ParameterName

The value is the name of this parameter.

Default: null.

Precision property 

public uint Precision

The value is the decimal precision of this parameter. Only used for SQLType.SQL_NUMERIC and SQLType.SQL_DECIMAL parameters.

Default: 0.

Scale property 

public short Scale

The value is the resolvable digits of this parameter. Only used for SQLType.SQL_NUMERIC and SQLType.SQL_DECIMAL parameters.

Default: 0.

Size property 

public uint Size

The value is the size in bytes of this parameter.

Default: Inferred from DbType.

Value property 

public object Value

The value is the value of this parameter.

Default: null.


Contents Index DBConnectionContext interface DBParameterCollection class