I am making a small database using sql server as the back and vb as the front end, I have nearly made it work however I have stumbled across this error:
An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll
Additional information: The multi-part identifier "System.Data.DataRowView" could not be bound.
Here is my code:
Imports System.Data.SqlClient
Public Class searchDialog
Private Sub searchDialog_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'SearchDataSet.Books' table.
'You can move, or remove it, as needed.
Me.BooksTableAdapter.Fill(Me.SearchDataSet.Books)
End Sub
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim ds As New DataSet
Dim query As String = "select * from Books where " + colNames.SelectedValue.ToString + " LIKE " + "'%" + colValues.Text + "%'"
BooksTableAdapter.Connection.Open()
Dim adp As New SqlDataAdapter(query, BooksTableAdapter.Connection.ConnectionString)
adp.Fill(ds, "Books")
BooksTableAdapter.Connection.Close()
filteredRecords.DataSource = ds
filteredRecords.DataMember = "Books"
End Sub
End Class