Currently i am working and using a filter function for my search however i not sure how to do it using a query

the sql statement is

cmd.CommandText = select * from tblcustomer where customerName like "'& textbox1.text &'"

I no there is some bits missing but i am not sure what they are could you please help as the filter function is proving to be slightly in effective

i am usig vb and sql

Recommended Answers

All 2 Replies

We can probably give more help if you can be more specific as to the type of search. Lacking that, it looks as if you are on the right track. SQL uses "%" and "_" for wildcarding. A good explanation with examples can be found here.

iv gt this far with the code
just not sure how it ends

Dim con As New SqlConnection
        Dim cmd As New SqlCommand

        con.ConnectionString = ("")

        cmd.Connection = con

        cmd.CommandText = "select * from tblCustomer where customerName like @field1 "
        cmd = New System.Data.SqlClient.SqlCommand(cmd.CommandText, con)
        With cmd
            .Parameters.AddWithValue("@field1", Tsearch.Text)
        End With

Be a part of the DaniWeb community

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