'数据库名称和路径。
Public Const DBPath As String = "\CompactFlash\JZKZ.sdf"
Public ssfields As String '保存实时存储数据库的实时数据字段名称
Public dbconn As New SqlCeConnection
Public dbcmd As New SqlCeCommand
'获取存在实时数据时的字段名称
Sub get_fields_name()
Dim i As Integer
ssfields = "时间"
For i = 1 To Pac1_MaxCDNo
ssfields = ssfields + "," + CD_Info(i).name
Next
End Sub
#Region " 机组控制 新建数据库 by w.c.d 2006.11.12"
'新建发电机组控制系统的数据库。
' by w.c.d 2006-11-12
Sub createDB()
' Dim dbconn As New SqlCeConnection
' Dim dbcmd As New SqlCeCommand
dbconn.ConnectionString = "data source =" + DBPath
dbcmd.Connection = dbconn
' File.Delete(DBPath)
If File.Exists(DBPath) Then
'dbconn.ConnectionString = "data source =" + DBPath
dbcmd.Connection = dbconn
Exit Sub
' If MsgBox("数据库已经存在,你确定需要重新建立(新建会删除全部数据)?", MsgBoxStyle.DefaultButton2 Or _
' MsgBoxStyle.Critical Or MsgBoxStyle.YesNo, "对话框") = MsgBoxResult.No Then ' User chose Yes.
'Exit Sub
' End If
' Application.DoEvents()
' File.Delete(DBPath)
End If
'Dimdbconn.As(New SqlCeConnection)
' Dim cmd As New SqlCeCommand
Dim ds As DataSet
Dim dlg As New Form
' if database does not exist, create one
If Not File.Exists(DBPath) Then
Dim sqlEngine As New SqlCeEngine("Data Source=" + DBPath)
sqlEngine.CreateDatabase() '生成数据库