DataQuery.cs 735 B

12345678910111213141516171819202122232425262728293031323334
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Data;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using Aitex.Core.RT.DBCore;
  8. using Aitex.Core.RT.Log;
  9. namespace MECF.Framework.Common.DBCore
  10. {
  11. public static class DataQuery
  12. {
  13. public static DataTable Query(string sql)
  14. {
  15. DataTable result = new DataTable("result");
  16. try
  17. {
  18. DataSet ds = DB.ExecuteDataset(sql);
  19. if (ds != null)
  20. {
  21. result = ds.Tables[0];
  22. }
  23. }
  24. catch (Exception ex)
  25. {
  26. LOG.Write(ex);
  27. }
  28. return result;
  29. }
  30. }
  31. }