HelpClass.cs.svn-base 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Data;
  6. using System.Collections;
  7. namespace Core.LgMes.Client.LgDeviceManager
  8. {
  9. class HelpClass
  10. {
  11. public DataSet CreateDataSet(DataTable alist)
  12. {
  13. DataSet ds = new DataSet();
  14. ds.Tables.Add(alist);
  15. return ds;
  16. //DataSet Createds = new DataSet();
  17. //DataTable dt = new DataTable();
  18. //int numString = 0;
  19. //if (alist != null)
  20. //{
  21. // foreach (Hashtable colum in alist)//构建列
  22. // {
  23. // numString++;
  24. // if (numString > 1)
  25. // {
  26. // break;
  27. // }
  28. // else
  29. // {
  30. // foreach (DictionaryEntry colName in colum)
  31. // {
  32. // dt.Columns.Add(colName.Key.ToString());
  33. // }
  34. // }
  35. // }
  36. // string name = "";
  37. // foreach (Hashtable list in alist)//构建行
  38. // {
  39. // DataRow row = dt.NewRow();
  40. // foreach (DictionaryEntry hs in list)
  41. // {
  42. // name = hs.Key.ToString();
  43. // row[name] = hs.Value;
  44. // }
  45. // dt.Rows.Add(row);
  46. // }
  47. // Createds.Tables.Add(dt);
  48. // return Createds;
  49. //}
  50. //else
  51. //{
  52. // return null;
  53. //}
  54. }
  55. }
  56. }