0

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
Thanks

2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by Farhan_B
1

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.

0

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 = ("")

        con.Open()
        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
        cmd.ExecuteReader()

        Dispose()

Edited by Farhan_B: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.