Merge branch 'master' of http://www.scserverddns.top:13000/sc/DyeingComputer
This commit is contained in:
commit
ecc19097bd
2 files changed
+64
-12
No files matched your search
@@ -655,8 +655,32 @@ namespace DyeingComputer.UserClass
|
||||
return buf.ToString();
|
||||
}
|
||||
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// 将 DataTable 转换为 Dictionary 类型数据
|
||||
/// </summary>
|
||||
public Dictionary<string, object> DataTableToDictionary(DataTable dataTable)
|
||||
{
|
||||
Dictionary<string, object> result = new Dictionary<string, object>();
|
||||
if (dataTable != null)
|
||||
{
|
||||
foreach (DataRow dataRow in dataTable.Rows)
|
||||
{
|
||||
foreach (DataColumn dataColumn in dataTable.Columns)
|
||||
{
|
||||
result.Add(dataColumn.ColumnName, dataRow[dataColumn].ToString());
|
||||
//result = Console.WriteLine(dataRow[dataColumn].ToString());
|
||||
//result.Add(dataColumn.ColumnName, dataRow[dataColumn].ToString())(new RepeatDictionaryComparer());
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result = null;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user