Click here to Skip to main content
15,914,162 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi friends
This is my sql table.
Section_id	Section_name	Standered_id	Acadamic_year_id
51	            A	             12	                   11
52	            B	             12	                   11
101	            A	             12	                   12
102	            B	             12	                   12


i returned this data in datatable objects for binding comboBox with the section name. by defauat it displayed like above.i have done this easily. but what i am not able to do is in the combo box only one A and B to bind. here standered id 12 mean their standered name is I class and Acadamic Year_id 11 means (2011-2012) 12 means (2012-2013). please help me
Posted
Comments
Santhosh Kumar Jayaraman 14-Aug-12 10:05am    
Your question is not clear
baskaran chellasamy 14-Aug-12 10:11am    
sorry, section__name contain two A and two B. But in combobox i want to bind only one A and one B.
[no name] 14-Aug-12 10:16am    
"please help me"... help you with what? You have not tried to do anything for yourself.
baskaran chellasamy 14-Aug-12 10:59am    
Mr wes aday sorry for my incomplete questions. I have tried with best then only i post this question.but now I solve my problem myself. and i would like to say to you i wont post any question without my effort.
Philip Stuyck 14-Aug-12 13:43pm    
It's ok to have questions but they have to be clear, and they need at least some effort to be shown.

Take a look at the search result from this page:
http://www.codeproject.com/search.aspx?q=WPF+combobox+database&doctypeid=1%3b2%3b3[^]

It shouwed a long list of different examples :)
 
Share this answer
 
try somethin like this.

before binding get distinct records from the table and bind it to gridview.

VB
cmbSectionName.DataSource=datatable1.AsEnumerable()
                           .Select(row => row.Field<string>("Section_Name"))
                           .Distinct()
                           .ToList();
cmbSectionName.DisplayMemberPath="Section_Name";
cmbSectionName.ValueMemberPath="Section_Name";

cmbSectionName.DataBind();
 
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