Applies To: |
|
Summary: |
How can I create or use a dBase (DBF) file with more than 128
fields (columns)? |
Solution: |
When CitectSCADA uses DBF files, it uses dBase III format which allows 128 fields. However, dBase IV format supports 250 fields. For Citect to use these files, it needs to connect using SQL/ODBC drivers. To connect using a System Device (Citect Project Editor | System menu | Devices), use these settings: Device: DbfDev Header: Dbq=c:\Data;Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277; FileName: Table1.dbf Type: SQL_DEV
FUNCTION CreateDBF() INT hSQL = SQLConnect("DBQ=C:\Data;Driver={Microsoft dBase Driver (*.dbf)};DriverId=277"); SQLExec(hSQL, "CREATE TABLE Report1 ([Time] TEXT(10), Tag TEXT(79), [Value] TEXT(32));"); SQLDisconnect(hSQL); END Use square brackets around field names that are reserved SQL keywords like 'Value'. You can also connect to the file using SQLExec(). Just use the text from the header field above as the connection string, and use the DBF file name as the table name in queries: INT hSQL; hSQL = SQLConnect("DBQ=C:\Data;Driver={Microsoft dBase Driver (*.dbf)};DriverId=277"); SQLExec(hSQL, "SELECT * FROM Table1"); |
Keywords: |
Related Links
Attachments