|
不是很理解你的说法。你是想使用代码加入数据?如果是,试试看这样的。
'存储实时数据到数据库。。。。。把队列的数据存入数据库。
Sub SaveSSData()
'Dim dbconn As New SqlCeConnection
' Dim dbcmd As New SqlCeCommand
'Dim cmd As New SqlCeCommand
dbconn.ConnectionString = "data source =" + DBPath
dbconn.Open()
dbcmd.Connection = dbconn
Dim tmp As String
While myQueue1.Count > 0
tmp = CType(myQueue1.Dequeue, String)
dbcmd.CommandText = "INSERT INTO SSData (" + ssfields + ") VALUES (" + tmp + ")"
dbcmd.ExecuteNonQuery()
End While
While myQueue.Count > 0
tmp = CType(myQueue.Dequeue, String)
dbcmd.CommandText = "INSERT INTO SSData (" + ssfields + ") VALUES (" + tmp + ")"
dbcmd.ExecuteNonQuery()
End While
dbconn.Close()
'dbcmd.Dispose() : dbconn.Dispose()
Application.DoEvents() 'GC.Collect()
End Sub
|
|