Using CitectSCADA > Using Devices > Formatting Data in the Device > Writing dBASE records using a database device

Writing dBASE records using a database device

To write data to a database device, first append a record to the end of the device, then add data to the fields of the record. For a dBASE database, the DevAppend() function appends the record, and the DevSetField() function writes data to a field. The following function writes a recipe record to a device:

FUNCTION 
WriteRecipeData(INT hDevice, STRING sName, INT Water, INT Sugar, INT Flour, INT Salt, INT Yeast, INT Milk)
DevAppend(hDevice);
DevSetField(hDevice, "NAME", sName);
DevSetField(hDevice, "WATER", IntToStr(Water));
DevSetField(hDevice, "SUGAR", IntToStr(Sugar));
DevSetField(hDevice, "FLOUR", IntToStr(Flour));
DevSetField(hDevice, "SALT", IntToStr(Salt));
DevSetField(hDevice, "YEAST", IntToStr(Yeast));
DevSetField(hDevice, "MILK", IntToStr(Milk));
END