private Sub insertRecsToTempBuffer(recList As List, tblTempMetaDataArg As tblTemp_Meta_t, N5Arg As Int)
Dim n As Int = 1
Dim listN As Int
listN = recList.Size
Dim qryStr As String
qryStr = _
$"INSERT INTO tblAgg2SecTemp(
julianDateUTC, ...
... JdateTime5MinStr)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);"$
sqlDbAggTemp.BeginTransaction
'Set up the arguments - values to be inserted
For Each row() As String In recList
Dim ArgArray As List
ArgArray.Initialize
ArgArray.Add(row(0))...
...
'If we are at the last records then add in the data time - don't do this for all the query is slow
If n = listN Then
'Add the time to the last record
ArgArray.Add(DateTime.Now) '13
Else
ArgArray.Add(0) '13
End If
ArgArray.Add(N5Arg) '14
ArgArray.Add(DateTime.Date(row(3)) & " " & DateTime.Time(row(3))) '15
ArgArray.Add(jdt.jdDateTimeToDateTimeStr(row(2))) '16
'Insert transaction
Try
sqlDbAggTemp.AddNonQueryToBatch(qryStr, ArgArray)
n = n + 1
Catch
closeAllDataBases
Dim LogMsgStr As String = "Insert records into AggTemp query failed"
setErrRecAndSave(8, listN, -1, LogMsgStr, LastException, True)
End Try
Next
'Execute batch insert query
Dim SenderFilter As Object = sqlDbAggTemp.ExecNonQueryBatch("sql")
Wait For (SenderFilter) sql_NonQueryComplete (Success As Boolean)