我已经按照所有教程连接并创建了一个基本命令。经过几个小时的诊断,我仍然无法找出错误。我做错了什么?
Imports System.Data.OleDb
Public Class Form2
Dim connStr As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=Databases11.accdb"
Dim conn As New OleDbConnection(connStr)
Dim command As OleDbCommand
Dim dt As DataTable
Dim da As OleDbDataAdapter
Dim sqlStr As String
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
sqlStr = "select * from Color"
dt = New DataTable()
da = New OleDbDataAdapter(sqlStr, connStr)
da.Fill(dt)
da.Dispose()
txtMID.Text = dt.Rows(0)("Color_Name")
End Sub
End Class
这是我看到的错误:
类型'System.Data.OleDb.OleDbException'的第一次机会异常 发生在System.Data.dll
中