This tutorial shows you how to wrap a SQL query statement into an
The SQL statement used for the tutorial is shown here:
The (
Prepare the Statement:
The steps to prepare a SQL statement are shown here.
Set up some constants used by the SQL statement object to define the SQL query:
This defines the query parameters.
Instantiate the
Define the indices to be used in the search:
Set the 32-bit integer value for the SQL parameter 'value':
The SQL parameter to which the integer is being assigned is identified by the constant
The parameter plus constant, along with other parts of the statement, are converted into:
in SQL syntax.
Prepare the statement:
This creates a parameterised SQL statement executable.
Run the SQL query:
Search the records until a match is found:
Next() fires the executable SQL statement and stops at and returns the matched record.
Do something if no results are found.
The query is done and you have the results. In this section we look at a simple way to do something with the results and we close the SQL statement object.
Get the results of the search:
Close the SQL search statement:
When the database search is finished the object should be closed to free up resources.
Now that you have performed a basic database query you can start thinking about more advanced querying options. The following will show you how:
This
+tutorial shows you how to wrap a SQL query statement into an
The SQL statement used for the tutorial is shown +here:
The (
Prepare the Statement:
The +steps to prepare a SQL statement are shown here.
Set up some constants +used by the SQL statement object to define the SQL query:
This +defines the query parameters.
Instantiate the
Define the indices to +be used in the search:
Set the 32-bit integer +value for the SQL parameter 'value':
The SQL
+parameter to which the integer is being assigned is identified by the constant
The parameter plus constant, +along with other parts of the statement, are converted into:
in SQL +syntax.
Prepare the statement:
This +creates a parameterised SQL statement executable.
Run the SQL query:
Search the records until +a match is found:
Next() fires the executable SQL statement and stops +at and returns the matched record.
Do something if no results are +found.
The query is done and +you have the results. In this section we look at a simple way to do something +with the results and we close the SQL statement object.
Get the results of the +search:
Close the SQL search +statement:
When +the database search is finished the object should be closed to free up resources.
This section deals with finding and returning the first matching +record
only. Getting all matches in a database is briefly discussed +at the end of this
section.
Now that you have +performed a basic database query you can start thinking about more advanced +querying options. The following will show you how: