Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

SQL Queries from 2 ComboBox determining third combobox

$
0
0
I have 3 comboBox..

and i wanted a code for the thirdcombobox , something like

"SELECT companyName FROM table where mainCategory = firstcombobox and subcategory = secondcombobox" , how do i do the sql query?

my maincategory combobox is called mainCatU , and the subcategory is subCatU

I managed to make subCatU's value based on mainCatU , now i wanted a third combobox value determined by both the value of the maincategory and subcategory.

it is either just an SQL Query or other thing?

can anyone help?

i have tried following some other codes such as

string strQuery = "SELECT * FROM Purchase where ItemID=(SELECT ItemID FROM ItemMaster where ItemName='" +  DropDownList3.SelectedItem.Text + '" and CategoryID=(SELECT CategoryID FROM ItemMaster where ItemName='"+ DropDownList3.SelectedItem.Text + '")"; 

But i do not use that.. since i am using it like this..

    SqlDataAdapter daSearch = new SqlDataAdapter("SELECT companyName FROM CompanyDetail", conn);

help please..

Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>