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

SQL Anywhere 10.0.1 » MobiLink - Server Administration » Writing Synchronization Scripts in .NET » MobiLink server API for .NET reference

GetVersion method Next Page

DBParameter class


Syntax

class DBParameter
Member of iAnywhere.MobiLink.Script

Remarks

Represents a bound ODBC parameter.

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

Example

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
Direction property
IsNullable property
ParameterName property
Precision property
Scale property
Size property
Value property