Halo Guys
I have a question in the Visual Basic (Microsoft Visual Basic 2013)
I am searching a table in the database using more than the TextBox and CompoBox (Note that LINQ to sql is used)
I have a table in the database of country names and another table of city names and another table of nationalities (and each one consists of name and number)
I mean the table of countries :
Name Number
UK 1
France 2 ... etc
And the table of the cities :
Name Number
London 1
Paris 2 ... etc
And the nationalities:
Name Number
British 1
French 2 ... etc
All tables are filled in Combobox
For names: Combibox.DisplayMember
And for numbers Combibox.ValueMember
Combibox.selectedValue = -1
And I have Windows form has
Textbox for the name
Combobox for gender
Combobox for country
Combobox for cities
Combobox Nationalities
The question is: I want to search for a specific record in the table
However, when I choice the gender and country and nationality and city (All together) are fine I have the result
But when I do not choice them ( the compubexs) or one of the compboxes does not perform the search and it show error
Is there any way to solve this problem? or how to solve this problem?
Also, it is not necessaryto choice any of the combobox , I mean some times I want to search just by names and I want the query of this kind of searching
Thank you all in advance
What I have tried:
This is how I fill the comboboxe and the countries and the nationalities are the same
Sub FillComb_Cities()
Comb_City.DataBindings.Clear()
Dim Cities = From CS In DB.CityLookups Order By CS.CityName
Comb_City.DataSource = Cities
Comb_City.DisplayMember = "CityName"
Comb_City.ValueMember = "CityId"
Comb_City.SelectedValue = -1
End Sub