This documentation was styled with a demo skin from the Premium Pack 4 add-on for Help & Manual. The contents of the skin are encrypted and not configurable. You can only publish HM projects with this skin. You cannot edit it or change it.
This version is copyright and may only be used for local testing purposes. It may not be distributed.
Please purchase the full version of the Premium Pack to get the configurable skins and remove this notice. The package will also include the Toolbox configuration utility for Premium Pack skins.
Description
Create an SQL look up statement in order to search for a specific field value
Syntax
s = <ADODB_Connection>.LookUpField (sTable, sFieldName, sWhere [, sOrderBy])
Returns
String.
Parameters
Name |
Type |
Optional |
Meaning |
sTable |
String |
No |
Name of the table in which to search |
sFieldName |
String |
No |
Name of a field to get data from |
sWhere |
String |
No |
SQL WHERE clause to apply (do not specify WHERE but only search criteria) |
sOrderBy |
String |
Yes |
SQL ORDER BY clause if necessary (do not specify ORDER BY but only fields to be ordered) |
Remarks
This function is not a standard ADODB function but a personalized thinBasic function.
It was designed because very often, when handling data from a DB, it is necessary to lookup just one value giving a SQL statement.
Instead to instantiate an ADODB_Recordset to just do one lookup, use this function.
This function will create a SQL statement assembling passed parameter in the following form:
SELECT TOP 1
sFieldName
FROM
sTable
WHERE
sWhere
ORDER BY
sOrderBy
<ADODB_Connection>.LookUpField will store previous recordset look up Table, Where and OrderBy data in order to be able to make consecutive field searches calling <ADODB_Connection>.LookUpField.Next method
Restrictions
This function will consider only the very first record (if any) from the temporary recordset that will be internally created.
See also
Examples