0

鉴于下面的代码,显示的错误是Type 'DataAccess' is not defined。我应该将什么导入 VB 以消除此错误?

Protected Sub ExportPOS(ByVal sender As Object, ByVal e As DirectEventArgs)
              Handles ExportButton.Click

    Try
    Make Connection

    Dim cnn As DataAccess = New DataAccess(Libatelconnectionstring)
        ........
4

1 回答 1

0

试试这个例程(来自 MSDN)..

Public Sub ConnectToAccess()
    Dim conn As New System.Data.OleDb.OleDbConnection()
    ' TODO: Modify the connection string and include any
    ' additional required properties for your database.
    conn.ConnectionString = & _
    "Provider=Microsoft.Jet.OLEDB.4.0;Data source=" & _
    "C:\Documents and Settings\username\My Documents\dbFile.mdb"
    Try
       conn.Open()
       ' Insert code to process data.
    Catch ex As Exception
       MessageBox.Show("Failed to connect to data source")
    Finally
       conn.Close()
    End Try
End Sub
于 2013-05-31T09:07:55.573 回答