0
我是Visual Basic的新手,我正在上一學期參加Visual Basic課程以獲得樂趣。我無法獲得datagridview來連接到我的導師給我的.MDF
SQL Server數據庫文件。我在sConnection.ConnectionString =「」上得到了一個空的異常錯誤,我對此感到茫然。在datagridview中打開SQL Server MDF文件
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
sConnection.ConnectionString = "Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\Jkome\Desktop\Kayaks.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"
sConnection.Open()
sCommand.CommandText = "Select * from KayakTypes;"
sReader = sCommand.ExecuteReader()
sTable.Load(sReader)
DGVkyaks.DataSource = sTable
嗯,首先:你有SQL Server的默認設置您的PC('SQLEXPRESS'的實例名稱)** **快速安裝? –