I have a problem on how to split data from serial port and then save it to access database to its designated column. i found an example written in VB.net but i cannot find an example code written in c#. the serial data will be like this:
,230,302
,230,302
and continuously.
This is what i have written so far:
void sp_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
Thread.Sleep(1000);
string[] data = _serialPort.ReadExisting().Split(',');
OleDbConnection connect = new OleDbConnection();
connect.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\xp\Desktop\HydroDatabase.accdb";
connect.Open();
OleDbCommand command = new OleDbCommand();
command.CommandText = "INSERT Into HydroLog(WaterFlow,TurbineRPM) Values(@data1, @data2)", connect);
}