ok so I have some data recording in to MS SQL but my issue is now that my database datetime column stopped populating in the server. I have an auto index and a datetime field that was populating for the first 147 entries Index still works fine.
Is there a way I can force a datetime from the code?
Private t As New TestDBDataSet.ShepleyDataTable
Private Sub DataSubscriber1_DataReturned(sender As Object, e As Drivers.Common.PlcComEventArgs) Handles DataSubscriber1.DataReturned
If t.Count = 0 Then
t.AddShepleyRow(t.NewRow)
End If
t(0).BH1 = e.Values(0)
If Not t(0).IsBH1Null And Not t(0).IsBH2Null And Not t(0).IsBH3Null Then
Using ta As New TestDBDataSetTableAdapters.ShepleyTableAdapter
ta.Update(t)
t.Clear()
End Using
End If
End Sub
Private Sub DataSubscriber2_DataReturned(sender As Object, e As Drivers.Common.PlcComEventArgs) Handles DataSubscriber2.DataReturned
If t.Count = 0 Then
t.AddShepleyRow(t.NewRow)
End If
t(0).BH2 = e.Values(0)
If Not t(0).IsBH1Null And Not t(0).IsBH2Null And Not t(0).IsBH3Null Then
Using ta As New TestDBDataSetTableAdapters.ShepleyTableAdapter
ta.Update(t)
t.Clear()
End Using
End If
End Sub
Private Sub DataSubscriber3_DataReturned(sender As Object, e As Drivers.Common.PlcComEventArgs) Handles DataSubscriber3.DataReturned
If t.Count = 0 Then
t.AddShepleyRow(t.NewRow)
End If
t(0).BH3 = e.Values(0)
If Not t(0).IsBH1Null And Not t(0).IsBH2Null And Not t(0).IsBH3Null Then
Using ta As New TestDBDataSetTableAdapters.ShepleyTableAdapter
ta.Update(t)
t.Clear()
End Using
End If
End Sub
I created my DB with this code and as i said it was populating then stopped..
CREATE TABLE Shepley (
ID int NOT NULL IDENTITY(1,1) PRIMARY KEY,
DataDateTime DATETIME DEFAULT CURRENT_TIMESTAMP,
BH1 nchar(10),
BH2 Nchar(10),
BH3 nchar(10),
BH4 Nchar(10),
BH5 nchar(10),
BH6 Nchar(10),
BH7 nchar(10),
BH8 Nchar(10),
BH9 nchar(10),
BH10 Nchar(10),
BH11 nchar(10),
BH12 Nchar(10),
BH13 nchar(10),
BH14 Nchar(10),
BH15 nchar(10),
BH16 Nchar(10),
);
147 2022-03-16 13:10:22.813 29.445 27.86 21.962 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
148 NULL 26.445 27.8 22.125 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL