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
精彩评论