简体   繁体   English

如何在组合框但不重复的C#中设置值

[英]How can I set value in combo-box But no-Repeat c#

I have an Excel sheet and I want to fetch some data from excel to c# but the data I have is repeated in some columns. 我有一个Excel工作表,我想从excel到c#中获取一些数据,但是某些列中重复了我的数据。

I need select this data in combo-box but no-repeat 我需要在组合框中选择此数据,但不能重复

OleDbDataAdapter da = new OleDbDataAdapter("SELECT  TL From [Data$]", conn);
        DataTable dt = new DataTable();
        da.Fill(dt);
        comboBox2.DataSource = dt;
        comboBox2.DisplayMember = "TL";

Please help me with this code, 请帮我提供此代码,

Thanks for all. 谢谢大家

在SQL查询中使用“ DISTINCT”命令:

SELECT DISTINCT TL From [Data$]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM