我正在製作一個小型數據庫,使用SQL Server作爲後臺,VB作爲前端,我幾乎已經制作了它的工作,但是我也偶然發現了這個錯誤:無法綁定多部分標識符「System.Data.DataRowView」SQL SERVER + VB.NET
"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."
我的代碼提供如下真的很感激一些幫助
乾杯
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, query)
BooksTableAdapter.Connection.Close()
filteredRecords.DataSource = ds
filteredRecords.DataMember = "Books"
End Sub
End Class
驗證'colNames.SelectedValue.ToString'是什麼等於。我相信它會產生'System.Data.DataRowView'。 –
是過濾記錄一個數據網格還是別的東西? – tgolisch