Dim conn As New OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source = e:\wms\wms\wms.mdb")
  conn.Open()
  Dim userDetailsAdapter As New OleDbDataAdapter("select * from daily_trans", conn)
  Dim userDetailsTable As New DataTable
  userDetailsAdapter.Fill(userDetailsTable)
  Dim returnRows() As System.Data.DataRow = Nothing
  returnRows = userDetailsTable.Select("cons = " & TextLine)

  If returnRows Is Nothing Then
                    MsgBox("Can be saved")
                Else
                    MsgBox("Primary Key")
  End If

**While executing the above query i am getting error as Cannot find column.

Kindly advice..**

Recommended Answers

All 3 Replies

Where exactly is the error; which line number?

First try this:

"SELECT * FROM [daily_trans]"

getting the error in 7th Line.

Please check your userDetailsTable wheather it is having rows? And the column ur selecting is exists? if exists the column name is correct?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.