C#: Connect to CDB¶
See also
C# - Examples
Problem Description¶
To connect to the CDB, the project must be configured. The example bellow shows how to connect to the CDB.
Problem Solution¶
// Connect to CDB, int sof_cdb_init ( char* FileName, int Index);
// Always use index 99, for more details see cdbase.chm
index = sof_cdb_init("S:\\test\\test.cdb", 99);
if (index < 0)
{
Console.WriteLine("ERROR: Index = " + index + " < 0 - see clib1.h for meaning of error code");
return;
}
else if(index == 0)
{
Console.WriteLine("ERROR: Index = " + index + " - The file is not a database");
return;
}
status = sof_cdb_status(index);
Console.WriteLine("Index: " + index);
Console.WriteLine("Status: " + status);
sof_cdb_close(0);
An example can be found by following:
C:\sofistik_installation\2020\SOFiSTiK 2020_dev\interfaces\examples\c#\connect_to_cdb
The folder contains:
Properties
(folder)app.config
program.cs
sofCDB.csproj
Run the sofCDB.csproj
and change the CDB path.
index = sof_cdb_init("S:\\test\\test.cdb", 99);