[求助]VB.net连接数据库的问题
运行时出现这样错误:未处理的“System.Data.OleDb.OleDbException”类型的异常出现在 system.data.dll 中。
代码:
Dim selectCmd As String = _
"Select id_no as 学号, name as 姓名, chi as 语文, eng as 英语, math as 数学 From SCORE"
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim connstr As String = _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source= & Data.mdb"
Dim conn As New OleDbConnection(connstr)
Dim myAdapter As New OleDbDataAdapter(selectCmd, conn)
Dim myDataSet As New DataSet
conn.Open() '错误的位置
myAdapter.Fill(myDataSet, "Score")
DataGrid1.DataSource = myDataSet.Tables("Score")
End Sub