需要向数据表大量写入数据,所以采用了后台直接写入。是这样把SQLCommand语句放到循环体内执行吗?是不是有点不妥啊?
For i As Integer = 0 To ja.count - 1
Dim ja1 As JArray = ja(i)
'直接写入后台数据
Dim cmd As new SQLCommand
cmd. Connection Name = "KEDAO"
cmd.CommandText = "Insert Into TBdaily (" & dcol & ") Values(" & cs & ")"
cmd.Parameters.Add("@name",ja1(0).ToString)
cmd.Parameters.Add("@date",ja1(1).ToString)
cmd.Parameters.Add("@om",ja1(2).ToString)
cmd.Parameters.Add("@high",ja1(3).ToString)
cmd.Parameters.Add("@low",ja1(4).ToString)
cmd.Parameters.Add("@end",ja1(5).ToString)
cmd.Parameters.Add("@pre",ja1(6).ToString)
cmd.Parameters.Add("@change",ja1(7).ToString)
cmd.Parameters.Add("@chg",ja1(8).ToString)
cmd.Parameters.Add("@vol",ja1(9).ToString)
cmd.Parameters.Add("@amount",ja1(10).ToString)
cmd.ExecuteNonQuery
Else
[此贴子已经被作者于2021/4/9 0:43:36编辑过]