在adt.Fill(ds)的System.Data.dll中发生了类型为'System.Data.OleDb.OleDbException'的未处理异常

时间:2018-12-12 08:06:18

标签: vb.net visual-studio ms-access

我是vb.net的新手。我想向您寻求帮助,为什么我会遇到此错误“在adt.Fill(ds)上的System.Data.dll中发生了'System.Data.OleDb.OleDbException类型的未处理的异常”

Imports System.Data.OleDb

Public Class Form2

    'global declarations

    Dim con As New OleDbConnection
    Dim adt As New OleDbDataAdapter
    Dim ds As New DataSet

    Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        con.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=C:/Users/ACER 170/Desktop/Document Tracking DOLE/MS Access Database/DocumentTrackingdata.accdb;"

        Timer1.Start()
    End Sub


    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        adt = New OleDbDataAdapter("INSERT INTO Table1 (TrackingNumber) values ('" & TextBox1.Text & "')", con)

        adt.Fill(ds)
        MsgBox("YES!")

        Timer1.Stop()

    End Sub

0 个答案:

没有答案