ERRCODE TFormer_SetODBCData ( HTFORM  pInstance,
LPCSTR  pszDSN,
LPCSTR  pszUser,
LPCSTR  pszPwd,
LPCSTR  pszSQLSelect 
)

Specifies an ODBC DataSource.

Returns:
- ErrOk (0) in case of success
- Non-zero if error occurred
Parameters:
[in] pInstance The TFORMer-Instance provided by a previous call to TFormer_Init.
[in] pszDSN DSN for ODBC-Connection
[in] pszUser User-Name for ODBC-Connection
[in] pszPwd Password for ODBC-Connection
[in] pszSQLSelect Select statement for fetching the data. Column names are treated as DataField names.
Remarks:
This DataSource enables TFORMer Runtime to use arbitrary database-tables or queries as a DataSource for printing a Job.
The data in such a table provides the values of the DataFields. The table is read Record by Record using the specified SQL statement SqlSelect. TFORMer Runtime must be able to match the column-names of the table with the corresponding DataField-names as used in the FormLayout. If required use SQL aliases to provide identical column names.
The order of the columns in the table or query does not matter.
Note:
Behavior if no input data was supplied: If no DataSource was specified (either by TFormer_SetXXXDataFile, TFormer_SetODBCData or via TFormer_NewRecord and TFormer_SetVarValue) the default data-file (located in the same directory as the FormLayout itself and generated by the last TFORMer Designer session) is used. If this default data-file does not exists no output will be produced. The name of the default data-file is path/FormName.xml.
This example demonstrates how to use the pre-installed ODBC DataSource (named TFORMer_Sample) for generating a report as PDF. The table tbl_Example looks like follows:
Sample Table
ChapterNumber Caption Pagenumber
1 Content 2
1.1 Table of Figures 6
1.2 List of Tables 6
2 Disclaimer 7
... ... ...

See also:
TFormer_SetTxtDataFile, TFormer_SetXmlDataFile, TFormer_SetImportFieldForRecordCopy.


© 2006-2009 - all rights reserved by TEC-IT Datenverarbeitung GmbH
Generated on Wed Sep 2 16:01:09 2009 for TFORMer Runtime DLL/Shared Library with doxygen 1.5.8