Searching database using keyword that will display all subject from database that has the keyword

47 views Asked by At

i am creating a system that will be tracking the coming in and out documents in an office. The user should be able to view the reports or the record. I have created a simple textbox that will serve as a search tool. The search process should allow the user to select the datagridview using a keyword.

example: if the user search for a record that has a keyword of "Book" the subject that has a word "book" in it should appear. example: keyword: book

     displays in datagridview: the book of secrets
                               book shelf
                               record book

Regardless of the uppercase or lowercase. kinda like GOOGLE

i tried creating a search process but it only shows the exact word and not the statement with the word "Book"

this is my code

Try
            connection.Open()

            Dim query As String
            query = "select id,Type_of_Document,Items,Received_From,Received_Date,Remarks,Marginal_Note,Referred_To,Referred_Date,Action_Taken  from tracker.recordtracker where Items = '" & srchtbx.Text & "'"
            Command = New MySqlCommand(query, connection)
            adapter.SelectCommand = command
            adapter.Fill(DataSet)
            bind.DataSource = DataSet
            DataGridView1.DataSource = bind
            adapter.Update(DataSet)
            connection.Close()
        Catch ex As Exception
            MsgBox(ex.Message)
        Finally
            connection.Dispose()
        End Try

any help is appreciated

1

There are 1 answers

2
jameshwart lopez On

In your where put % like this

where Items Like '%" & srchtbx.Text & "%'