Dim con As New OleDb.OleDbConnection
Dim dbProvider As String
Dim dbSource As String
Dim ds As New DataSet
Dim da As New OleDb.OleDbDataAdapter
Dim sql As String
dbProvider = "Provider=Microsoft.Jet.OLEDB.4.0;"
dbSource = "Data Source = C:\Users\Blessing\Documents\Ishvatest.mdb"
con.Connectionstring = dbProvider & dbSource
con.Open()
sql = "SELECT * From Employees"
da = New OleDb.OleDBDataAdapter(sql, con)
da.Fill(ds, "Ishvatest")
MsgBox("Ishvatest is now open")
con.Close()
MsgBox("Ishvatest is now closed")
txtID.Text = ds.Tables("Employees").Rows(0).Item(1)
txtID.Name = ds.Tables("Employees").Rows(0).Item(2)
如果我使用此代码运行程序,则会收到错误“未处理空引用异常”
我的代码有什么问题?