我創建了一個數據庫使用SQlServer CE與db.sdf的名稱使用下面的代碼。VB.NET掌上電腦數據庫連接
Dim connStr As String = "Data Source =\temp\emp.sdf;"
Try
'creating database
Dim engine As SqlCeEngine
engine = New SqlCeEngine(connStr)
engine.CreateDatabase()
engine.Dispose()
'creating table
Dim cn As New SqlCeConnection(connStr)
Dim sql As String
sql = "CREATE TABLE login "
sql &= "("
sql &= " username nvarchar(20) PRIMARY KEY,"
sql &= " password nvarchar(20)"
sql &= ")"
Dim cmd As New SqlCeCommand(sql, cn)
cmd.Connection.Open()
cmd.ExecuteNonQuery()
cmd.Connection.Close()
cmd.Dispose()
cn.Dispose()
MessageBox.Show("Succesfully created")
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
但我不知道它保留了這個emp.sdf文件以及如何查看它。我今天剛剛開始使用VB.NET Pocket PC應用程序,而且我非常困惑,因爲我的VB.NET連接代碼與Pocket PC應用程序不兼容,所以請幫助我如何解決此問題。請任何教程,可以幫助我。 感謝