Click here to Skip to main content
16,004,678 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
column1 column2 column3
2 1133 assam
3 2244 delhi
now suppose from combobox i have select 1133 then how it will compare database values that it is already in database.
Posted

Try:
SQL
SELECT COUNT(*) FROM MyTable WHERE MyColumn2=1133
If it returns zero, it's not in the DB.
 
Share this answer
 
v2
C#
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
   //send DB Call and get the value from database
   
if (comboBox1.SelectedItem.ToString()== "DB value") // Compare here
   {
    
   }
  
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900