public static Hashtable ToHashTable(DataTable dt, string key,string value)
{
Hashtable ht=new Hashtable();
foreach (DataRow dr in dt.Rows)
{
if (!ht.ContainsKey(dr[key]))
{
ht.Add(dr[key], dr[value]);
}
}
return ht;
}
{
Hashtable ht=new Hashtable();
foreach (DataRow dr in dt.Rows)
{
if (!ht.ContainsKey(dr[key]))
{
ht.Add(dr[key], dr[value]);
}
}
return ht;
}
No comments:
Post a Comment