string[] temp = null;//存放已经入库的影片路径
sql= "select originalName from DelFileList order by id desc";
DataTable tb = db.getTable(sql);
if (tb.Rows.Count > 0)
...{
//对重复的数据进行筛选
Hashtable ht = new Hashtable();
foreach (DataRow dr in tb.Rows)
...{
string s = dr["originalName"];
if (!ht.Contains(s))
ht[s] = dr["originalName"];
}
temp = new string[ht.Count];
ht.Keys.CopyTo(temp, 0);
}
本文介绍了一种从数据库中筛选并去除重复数据的方法。通过使用Hashtable数据结构,确保了获取到的每一条记录都是唯一的,并将这些唯一记录存储在一个字符串数组中。此过程涉及到SQL查询、数据表操作及循环遍历等步骤。
359

被折叠的 条评论
为什么被折叠?



