Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.0 » MobiLink - Server Administration » MobiLink Server APIs » Writing synchronization scripts in .NET » MobiLink server API for .NET reference


DBParameter class

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( ?,?,? )";
  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();

DbType property
Direction property
IsNullable property
ParameterName property
Precision property
Scale property
Size property
Value property