Click here to Skip to main content
15,895,283 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I try this Code But Data Not Show

What I have tried:

private void fillCombo()
{
String connstring = ConfigurationManager.ConnectionStrings["FincorpData"].ConnectionString;
using (OleDbConnection con = new OleDbConnection(connstring))
{
using (OleDbDataAdapter oda = new OleDbDataAdapter("select DealerName form Dealer", con))
{
DataTable dt = new DataTable();
oda.Fill(dt);
comboBox1.DataSource = dt;
comboBox1.DisplayMember = "DealerName";

}
}
}
Posted
Updated 28-Mar-20 5:06am

1 solution

No, it won't.
And if you used the debugger, or even a try...catch block, you'd find out why.

Spelling is important! Compare:
SQL
"select DealerName form Dealer"
Against:
SQL
"select DealerName FROM Dealer"
 
Share this answer
 
v2
Comments
Amar chand123 28-Mar-20 11:25am    
Thanks
OriginalGriff 28-Mar-20 11:33am    
You're welcome!

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