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

SQL Anywhere 11.0.1 (中文) » UltraLite - .NET 编程 » UltraLite .NET 2.0 API 参考 » ULParameter 类 » ULParameter 构造函数

 

ULParameter(String, Object) 构造函数

用指定参数名和值初始化 ULParameter 对象。

语法
Visual Basic
Public Sub New( _
   ByVal parameterName As String, _
   ByVal value As Object _
)
C#
public  ULParameter(
   string  parameterName,
   object value
);
参数
  • parameterName   参数的名称。对于未命名参数,请使用一个空字符串 ("") 或空值引用(在 Visual Basic 中为 Nothing)作为其值。在 UltraLite.NET 中,参数名不由 ULCommand 来使用。

  • value   要作为参数值的 System.Object。

注释

鉴于系统对 0 和 0.0 常量的特殊处理方法以及对重载方法的解析方式,我们强烈建议您在使用此构造函数时显示地将常量值转换为类型对象。

示例

以下代码将创建一个值为 0 的 ULParameter 对象,并将其添加至名为 cmd 的 ULCommand 中。

' Visual Basic
cmd.Parameters.Add( New ULParameter( "", CType( 0, Object ) ) )

// C#
cmd.Parameters.Add( new ULParameter( "", (object)0 ) );
另请参见