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

SQL Anywhere 10.0.1 » UltraLite - .NET Programming » UltraLite .NET 2.0 API Reference » ULCommand class

ULCommand(String, ULConnection, ULTransaction) constructor Next Page

CommandText property


Specifies the text of the SQL statement or the name of the table when the ULCommand.CommandType is System.Data.CommandType.TableDirect. For parameterized statements, use a question mark (?) placeholder to pass parameters.

Syntax

Visual Basic

Public Overrides Property CommandText As String

C#

public override string CommandText { get; set; }

Property value

A string specifying the text of the SQL statement or the name of the table. The default is an empty string (invalid command).

Remarks

It is recommended that SELECT statements used to create read-only result sets (ULCommand.ExecuteReader() or ULCommand.ExecuteScalar) should end with " FOR READ ONLY". For some statements that use temporary tables, there may be a significant performance improvement.

Example

The following example demonstrates the use of the parameterized placeholder:

' Visual Basic
myCmd.CommandText = "SELECT * FROM Customers WHERE CustomerID = ?"

// C#
myCmd.CommandText = "SELECT * FROM Customers WHERE CustomerID = ?";
See also