Click here to Skip to main content
15,905,776 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
I will have repeat numbers everytime i change selected index

What I have tried:

using (SqlConnection con = new SqlConnection(conString))
{
using (SqlDataAdapter sda = new SqlDataAdapter())
{
cmd.Connection = con;
con.Open();
ddl.DataSource = cmd.ExecuteReader();
ddl.DataTextField = text;
ddl.DataValueField = value;
ddl.DataBind();
con.Close();
}
}
sqlStr.AppendLine("SELECT LoanTerm, LoanRate From TDLoanRate ");
sqlStr.AppendLine("where GETDATE() between LoanEffectFrom and LoanMaturity");
Posted
Updated 28-Jul-16 4:12am
Comments
Karthik_Mahalingam 28-Jul-16 9:57am    
what is the issue, and also your code is incomplete

1 solution

Your question title has the answer in itself, if you wanted to select the DISTINCT content, use the SQL query:
SQL
SELECT DISTINCT LoanTerm, LoanRate From...

This would return distinct records, for more on how to use this, please read this: ALL, DISTINCT, DISTINCTROW, TOP Predicates (Microsoft Access SQL) [Access 2007 Developer Reference][^].

Secondly, reading your question second time,
Quote:
I will have repeat numbers everytime i change selected index
Makes me think that maybe the problem is that you are having multiple records in the dropdown itself. For that, I simply clear the previous items in the dropdown and load the new list in the dropdown. You can try clearing the data source and set it again, or change the ItemsSource value to set it again.
 
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