Applies To:
  • CitectSCADA 3.xx, 4.xx, 5.xx

Summary:
I am using DevOpen("My_Database",2) to access a data file in my project.  The device My_Database is defined correctly and the file called INFO1.DBF is in the project directory, but when I call DevSize() it returns 0 indicating that the database is empty!

Solution:
The function DevOpen() has three possible modes of operation -

1. If the file exists and can be opened then a file handle is returned.

2. If the file exists and cannot be opened then -1 is returned.

3. If the file does not exist then an empty database is created in the directory and a file handle is returned.

Note: If mode 2 is used and an index file cannot be found, then it is automatically created.  The Header field of the device definition should specify the name of the field in the database that is to be used as the primary index field.

If you are running your project from CitectRuntime, CitectExplorer, ProjectEditor or GraphicsBuilder then the default path is the \Citect\Bin directory and so in this case DevOpen() will look for INFO1.DBF in that directory.  If you run the project from CicodeEditor then the default directory is the \Citect\User\<project_name> directory and the so file will open successfully.

Always specify the path to your files in Cicode.  In this case, the path should be - [RUN]:INFO1.DBF

 

Keywords:
 

Attachments