Is it possible to write into an SQLite DB via C#?
The idea is that a C# -Skript , which is running on a PLCnext and is programmed in the Framework for Visual Studio, gets values from the PLCnext and write it into an Sqlite DB. The DB is located on a Windows-Control-Panel. Is this Possible? If yes, how?
Comments
Hi Jonas,
I am afraid that it is not possible to write directly to a sqlite database from C# code running on the real-time part of the PLCnext Runtime. The embedded CLR does not include classes that would make this (easily) possible.
~ Martin.
First of all thank you for the quick response. I read about C++ and SQLite. Is this the only way to go? An other idea is to get the values out of the PLCnext to the Windows-Control-Panel via Net Sockets and then write it into the SQLite DB with a C# Skript running on the Panel. Does Net Sockets work in the CLR or is an other way maybe the better or easier decision? I only need a way to get the values from the PLC into a different C# Skript to put them in a SQLite DB.
Hi Jonas,
Have you considered using either OPC UA or REST to read data from the PLC? This might be simpler than writing your own inter-process communication mechanism using TCP sockets, which is also possible.
e.g. a C# program on the Windows control panel can be an OPC UA Client, or a REST client, and read data from the PLC using industry-standard OPC UA or REST interfaces. I don't know what other software is running on the control panel, but industrial HMI software usually includes OPC UA client functionality, so this might provide another solution.
~ Martin.