合并关联表数据
/// <summary>
/// 合并为一条
/// </summary>
/// <param name="ds">主Table</param>
/// <param name="hds">附加table</param>
/// <returns></returns>
private DataSet Merge(DataSet ds, DataSet hds)
{
Hashtable ht = new Hashtable();
ht.Add("TERMINALID", "TERMINALID");
ht.Add("SYNTIME", "SYNTIME");
foreach (DataRow dr in hds.Tables[0].Rows) ///遍历所有的行
{
foreach (DataColumn dc in hds.Tables[0].Columns) //遍历所有的列
{
if (!ht.Contains(dc.ColumnName.ToUpper()))
{
ds.Tables[0].Columns.Add(dc.ColumnName, typeof(System.String));
ds.Tables[0].Rows[0][dc.ColumnName] = dr[dc].ToString();
}
}
}
return ds;
}