Sybase 2 Barcode Reader User Manual


 
Using SQL Select
130 DataWindow .NET
To define retrieval arguments:
1 In the Select painter, select Design>Retrieval Arguments from the menu
bar.
2 Enter a name and select a datatype for each argument.
You can enter any valid SQL identifier for the argument name. The
position number identifies the argument position in the
Retrieve method
you code in a script that retrieves data into the DataWindow object.
3 Click Add to define additional arguments as needed and click OK when
done.
Specifying an array as
a retrieval argument
You can specify an array of values as your retrieval argument. Choose the type
of array from the Type drop-down list in the Specify Retrieval Arguments
dialog box. You specify an array if you want to use the
IN operator in your
WHERE clause to retrieve rows that match one of a set of values. For example:
SELECT * from employee
WHERE dept_id IN (100, 200, 500)
retrieves all employees in department 100, 200, or 500. If you want your user
to specify the list of departments to retrieve, you define the retrieval argument
as a number array (such as 100, 200, 500).
In the code that does the retrieval, you declare an array and reference it in
the
Retrieve method.
DataWindow Designer passes the appropriate comma-delimited list to the
method (such as 100, 200, 500 if x[1] = 100, x[2] = 200, and x[3] = 500).
When building the
SELECT statement, you reference the retrieval arguments in
the
WHERE or HAVING clause, as described in the next section.
Specifying selection, sorting, and grouping criteria
In the SELECT statement associated with a DataWindow object, you can add
selection, sorting, and grouping criteria that are added to the SQL statement
and processed by the DBMS as part of the retrieval.
Table 4-4: Adding selection, sorting, and grouping criteria to the
SELECT statement
To do this Use this clause
Limit the data that is retrieved from the database
WHERE
Sort the retrieved data before it is brought into the
DataWindow object
ORDER BY