Hi All,
I’m trying to write a list of points to an InfluxDB through a C# windows form application ( .NET 6 )
InfluxDB 2.3
InfluxDB Client library 4.3.0
The code is pretty simple so I really don’t know what is going on.
using System.Data;
using InfluxDB.Client;
using InfluxDB.Client.Api.Domain;
namespace Test
{
public partial class frm1 : Form
{
const string token = "Token from influxDB WebPage";
const string bucket = "Test15";
const string org = "Company";
InfluxDBClient _client;
WriteApi _writeApi;
List<string> list_of_lines = new List<string>();
List<string> tables = new List<String>()
{"R12WD","R12Aer","R12BCA","R12Mag","R12Nov","R12Nov_R","R12EV_Su","R12EV_Giu",
"R12AUTO_Giu","R12MAN_Giu","R12Avanti","R12Indietro",
"R12RUN","R12Diam_SET","R12I_MRI","R12I_MRS","R12hRS","R12Vel_Rif"};
long unixMilliSeconds;
string data = "";
DateTime t;
public frm1()
{
InitializeComponent();
_client = InfluxDBClientFactory.Create("http://localhost:8086", token);
//var health = _client.PingAsync();
//MessageBox.Show(String.Format("Health: {0}", health.Status));
_writeApi = _client.GetWriteApi();
}
private void button1_Click(object sender, EventArgs e)
{
t = DateTime.Now;
unixMilliSeconds = (t.ToUniversalTime().Ticks - new DateTime(1970, 1, 1).Ticks) / 10000;
list_of_lines.Clear();
for (int i = 0; i < tables.Count; i++)
{
data = String.Format("{0} val={1}i {2}", tables[i], t.Second, unixMilliSeconds);
list_of_lines.Add(data);
}
}
}
}
It just doesn’t insert the points as it should.
The same code on a Windows Console Application (C#) is working.
Can someone help?
Cheers,