开发者

Problem with my VB2005-MSAccess Connection

开发者 https://www.devze.com 2023-02-16 23:52 出处:网络
I am using MS Access as a database, but the error occurs in column Abstract. Error message: Column \'Abstract\' does not belong to table tblBooks

I am using MS Access as a database, but the error occurs in column Abstract.

Error message:

Column 'Abstract' does not belong to table tblBooks

This column is actually included in t开发者_运维百科he table but I'm not sure if the problem is its DataType.(Memo)

Is it possible to use this field with Memo datatype? Is there any error with my code (using my module)?

My code:

Module Module1
    Public MyConn As New OdbcConnection("Dsn=MS Access Database;dbq=D:\MyPrograms\VB.Net\Library System\dblibrary.mdb;defaultdir=D:\MyPrograms\VB.Net\Library System;driverid=25;fil=MS Access;maxbuffersize=2048;pagetimeout=5;uid=admin")
    Public MyComm As New OdbcCommand
    Public MyTable As New DataSet
    Public MyAdapt As New OdbcDataAdapter
    Public Counter As Integer

    Function Adapt(ByVal MyCommand As String, ByVal MyDataSet As String) As String
        MyAdapt = New OdbcDataAdapter(MyCommand, MyConn)
        MyAdapt.Fill(MyTable, MyDataSet)
        Return 0
    End Function
End Module



Private Sub Search()

     If cmbCategoryFilter.SelectedItem = "All" Then
        Adapt("select * from tblBooks", "tblBooks")
        txtISBNInfo.Text = MyTable.Tables(0).Rows(Counter)("ISBN").ToString
        txtTitleInfo.Text = MyTable.Tables(0).Rows(Counter)("Title").ToString
        txtAuthorInfo.Text = MyTable.Tables(0).Rows(Counter)("Author").ToString
        txtAbstractInfo.Text = MyTable.Tables(0).Rows(Counter)("Abstract").ToString
     End If

End Sub
0

精彩评论

暂无评论...
验证码 换一张
取 消