PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Accessing a database found on Mobile Device (Pocket PC)
  • Managing the columns found in the standard databases of Mobile Device (tasks, contacts, ...)
  • Browsing the records corresponding to a condition
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Positions on the first file record whose value for a specific column is equal to a sought value (exact-match search). The record is read.
In most cases, cdbReadSeek is used to position in the data file in order to perform a browse loop among the records corresponding to a condition. cdbReadNext is used to read the next record corresponding to the condition.
Several cases may occur after the call to cdbReadSeek:
  • a record corresponding to the condition was found and loaded in memory: cdbReadSeek returns True, cdbFound returns True.
  • the data file is empty or there is no record corresponding to the condition: no reading is performed, cdbReadSeek returns False and cdbOut returns True.
Caution: From Windows Mobile 5, the access to a standard database (tasks, contacts, appointments, ...) can no longer be performed from a Windows application (and therefore from a standard WINDEV application).
Accessible from the PC
Accessible from the simulator
Accessible from the Mobile Device (Pocket PC)
CDB database
Yes
Yes
Yes
Standard database
No
No
Yes
Example
// Find the first record for which the customer name is Smith
ResSearch = cdbReadSeek("MyDatabase", "Customer", "Name", "Smith")
// Record found?
WHILE cdbFound("MyDatabase", "Customer") = True
Counter ++
cdbReadNext("MyDatabase", "Customer")
END
// Number of records found?
Info("Number of customers who are named Smith: " + Counter)
// Find the first record for which the customer name starts with Smith
ResSearch = cdbReadSeek("MyDatabase", "Customer", OX3A16001F, "Smith", ...
cdbFromIdentifier + cdbStartsWith)
...
Syntax
<Result> = cdbReadSeek(<Database Name> , <File Name> , <Column> , <Sought Value> [, <Option>])
<Result>: Boolean
  • True if a record was found,
  • False otherwise (if the column does not correspond to a key for example). To find out the error details, use ErrorInfo.
<Database Name>: Character string (with quotes)
  • Name of database that was opened by cdbOpen,
  • Empty string ("") to handle one of the standard databases found on Mobile Device (tasks, contacts, ...).
<File Name>: Character string (with quotes)
Data file to use. This parameter corresponds to:
  • the name of data file to use.
  • the constant corresponding to one of the standard databases:
    cdbContact"Contacts" database
    cdbTask"Tasks" database
    cdbAppointment"Appointments" database

If this parameter corresponds to an empty string (""), cdbReadSeek handles the last data file used by the last function for managing the Mobile DEvice databases (starting with the letters cdb).
<Column>: Integer or character string (with quotes)
Key column to use. This parameter can correspond to:
  • the name of the column.
  • the identifier of the column. In this case, the cdbFromIdentifier constant must be specified in the <Option> parameter.
  • the subscript of the column.
For a standard database of the Mobile Device (tasks, contacts, ...), use one of the constants found in the "cdbConst.WL" file. See remarks for more details.
<Sought Value>: Type of the sought value
Value to find.
<Option>: Optional Integer constant (or combination of constants)
Options that must be taken into account:
cdbStartsWith"Starts with" search (generic search).
This type of search can be performed on the text columns only.
An exact-match search is performed by default.
cdbFromIdentifierIndicates that the <Column> parameter corresponds to the identifier of the column.

These two constants can be combined.
Remarks

Accessing a database found on Mobile Device (Pocket PC)

The table below presents the actions that must be performed to access a database found on Mobile Device:
Database
Standard database (tasks, contacts, appointments, ...)
WINDEV application
  1. Establish a connection between the current computer and the Mobile Device (ceConnect).
  2. Open the database to use (cdbOpen).
Establish a connection between the current computer and the Mobile Device (ceConnect).
WINDEV Mobile applicationOpen the database to use (cdbOpen).No specific action is required.

Reminder: From Windows Mobile 5, the access to a standard database (tasks, contacts, appointments, ...) can no longer be performed from a Windows application (and therefore from a standard WINDEV application).

Managing the columns found in the standard databases of Mobile Device (tasks, contacts, ...)

To manage the different columns found in the standard databases of Mobile Device (tasks, contacts, ...):
1. Include the "cdbConst.wl" file in your project. This file lists all the identifiers of the columns found in the standard databases of Mobile Device (tasks, contacts, ...). To use this file in your project, the EXTERN keyword must be specified as follows:
// -- Initialization code of project
EXTERN "cdbConst.wl"
2. Use the constants found in the "cdbConst.wl" file:
ResSearch = cdbReadSeek("", cdbContact, CDB_CONTACT_DISPLAYEDNAME, "Smith", cdbFromIdentifier)
Note: the search can only be performed on a key column. The key columns for the standard databases found on the Mobile Device are as follows:
Contacts databaseFirst name
Name displayed
Company
Tasks databaseObject
Priority
Status
Appointments databaseDate
Duration

Special case: Search on the "Name displayed" key:
This item being made of the first and last names, we recommend that you perform a "Starts with" search.

Browsing the records corresponding to a condition

In most cases, cdbReadSeek is used to position in the data file in order to perform a browse loop among the records corresponding to a condition. cdbReadNext is used to read the next record corresponding to the condition.
To ignore the search while going to the next record, use one of the following functions:
Limitation: Lors d'une recherche, il n'est pas possible de se positionner sur l'enregistrement précédent correspondant à la condition recherchée (fonction cdbReadPrevious). The search is not canceled and cdbReadPrevious returns False.
Components
WINDEVReports and QueriesWindows Mobile wd230ce.dll
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment