You just type your SQL's correctly.
For example purposes, I want to be able to search my customer database for every customer who has "tan" in the name.
My "FillBy" query on my Customer tableAdapter will be:
SELECT * FROM Customer WHERE CustomerName LIKE @CustomerName
On my form I have a datagrid bound to the Customer tableAdapter and a textbox (txtCustomer) and button (btnSearch).
On the button click the following happens;
Private Sub btnSearch_Click (...... ) Handles btnSearch.Click
If me.txtCustomer.text = Nothing Then
messagebox.show("You must enter a search string")
Else
dim strCustomer as string = "%" & me.txtCustomer.text & "%"
me.CustomerTableAdapter.FillByCustomerSearch(me.dsCustomer.Customer, strCustomer)
End If
^^ if the textbox is empty when the button is pressed, a messagebox pops up.
The textbox text is wrapped in % - this is the SQL wildcard. Because it's %tan% , it means that it will search for any customer that has tan in it, if you want it to start with tan you remove the first % so its just tan%.
Therefore in my fictional example, the datagrid is filled with:
Stanbra
Setana
Tanner
but what if I have to show results with more than one condition using one textbox for example if I have to use select * from airlines where tick_no = @tick_no or passenger_name="James".
Don't quite understand what you mean, as in your example you have hardcoded the passenger_name.
Your SQL query would be
SELECT * FROM Airlines WHERE tick_no = @tick_no OR passenger_name = @passengername
You then need to provide the 2 variables to the FillBy query on the form.
Dim intTicket as integer = "1234"
Dim strPassenger as string = "James"
AirlineTableAdapter.FillByTicketOrPassenger(me.dsAirline.Airline, intTicket, strPassenger)
I made up the names of the tableAdapter, FillBy query and dataSet - you would obviously replace them with your own.
That query will then load any rows that has the ticket number 1234 or the passenger name of James.