When you update data in the DataWindow painter, PocketBuilder builds a SQL UPDATE statement in the background. The DateTime DBParm parameter determines how PocketBuilder specifies a DateTime datatype when it builds the SQL UPDATE statement. (A DateTime datatype contains both a date value and a time value.)
ODBC
The syntax you use to specify the DateTime DBParm differs slightly depending on the database.
The Database Profile Setup dialog box inserts special characters (quotes and backslashes) where needed, so you can specify just the DateTime format.
In a PocketBuilder application script, you must use the following syntax. PocketBuilder parses the backslash followed by two single quotes (\'') as a single quote when it builds the SQL UPDATE statement.
DateTime = ' \''DateTime_format\'' '
Parameter |
Description |
---|---|
'\ '' |
Type a single quote, followed by one space, followed by a backslash, followed by two single quotes. There is no space between the two single quotes and the beginning of the DateTime format. |
DateTime_format |
The DateTime format you want PocketBuilder to use when it builds a SQL UPDATE statement to update a data source in the painter. For more on display formats, see the Users Guide. |
\'' ' |
Type a backslash, followed by two single quotes, followed by one space, followed by a single quote. There is no space between the end of the date format and the backslash. |
If no value is specified for the DateTime DBParm parameter, PocketBuilder looks for a DateTime format in the section for your ODBC driver in the pkodb25 initialization file. If no DateTime format is found in the initialization file, PocketBuilder uses the ODBC DateTime format escape sequence.
Assume you are updating a table named Files by setting the Timestamp column to 4/2/07 3:45 pm. This DateTime is represented by the following DateTime format. To specify that PocketBuilder should use this format for the DateTime datatype when it builds the SQL UPDATE statement:
Database profile Type the following in the DateTime Format box on the Syntax tab in the Database Profile Setup dialog box:
m/d/yy h:mm am/pm
PocketBuilder application script Type the following in a PocketBuilder application script:
SQLCA.dbParm = "DateTime =
' \''m/d/yy h:mm am/pm\'' '"
What happens PocketBuilder builds the following SQL UPDATE statement to update the table:
UPDATE FILES
SET TIMESTAMP = '4/2/07 3:45 pm'