DataQuery.cs 849 B

1234567891011121314151617181920212223242526272829303132333435363738
  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 && ds.Tables.Count != 0)
  20. {
  21. result = ds.Tables[0];
  22. }
  23. else
  24. {
  25. return null;
  26. }
  27. }
  28. catch (Exception ex)
  29. {
  30. LOG.Write(ex);
  31. }
  32. return result;
  33. }
  34. }
  35. }