General .NET DataTable Adapter example
Here we describe the different fields of application for the .NET DataTable Adapter by way of a small example.
The completed Definition file "DataTableAdapter_Common.fhd" you will find in the Examples\EN\DataTableAdapter directory. In addition, in the VSCommon directory within the DataTable Adapter directory contains a Visual Studio Solution that includes all examples in .NET Source Code (C#). All examples are enclosed in the ZIP archive of FlowHeater.
This time there are no step-by-step instructions, instead we explain how to make use of the .NET DataTable Adapter by reference to the completed Definition (see below).
Your own Adapter
When you open the Definition in the FlowHeater Designer your screen will appear similar to the screenshot depicted above. The DateTable Adapter is connected to both READ and WRITE sides. Execute the Definition in test mode and once again so as if you wanted to write the data. See also the help in the Execute and Test popup.
Please note: you will see no popup box with the first run. This is because in test mode the .NET DLL on the WRITE side is not invoked. Only the .NET DLL on the READ side is executed.
Where does the data come from and where is it written?
- On the READ side the function publicDataTable FlowHeater_GetDataTable(int rows) in the class FH_Read from the assembly/DLL ReadSample.dll is called.
- On the WRITE side the function publicvoid FlowHeater_SetDataTable(DataTable dt) in the class FH_Write from the assembly/DLL WriteSample.dll is called.
The names of the assemblies/DLLs and the class names are arbitrary and can be chosen freely. The class that is to be called simply has to contain the above named functions. Both DLLs are included in the directory Examples\EN\DataTableAdapter\VSCommonBin.
Also take a look at the Visual Studio solution. You will find the solution in the directory Examples\EN\DataTableAdapter\VSCommon.