1

私はSQLサーバーをバックとして使用し、vbをフロントエンドとして使用して小さなデータベースを作成していますが、ほとんど機能しましたが、このエラーに出くわしました:

System.Data.dll で 'System.Data.SqlClient.SqlException' 型の未処理の例外が発生しました

追加情報: マルチパート識別子 "System.Data.DataRowView" をバインドできませんでした。

これが私のコードです:

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
4

1 に答える 1