RoadFlow2.1 临时演示

TestSql.ashx.cs 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. namespace WebForm.Platform.WorkFlowFormDesigner
  6. {
  7. /// <summary>
  8. /// TestSql 的摘要说明
  9. /// </summary>
  10. public class TestSql : IHttpHandler
  11. {
  12. public void ProcessRequest(HttpContext context)
  13. {
  14. context.Response.ContentType = "text/plain";
  15. string sql = context.Request["sql"];
  16. string dbconn = context.Request["dbconn"];
  17. if (sql.IsNullOrEmpty() || !dbconn.IsGuid())
  18. {
  19. context.Response.Write("SQL语句为空或未设置数据连接");
  20. return;
  21. }
  22. RoadFlow.Platform.DBConnection bdbconn = new RoadFlow.Platform.DBConnection();
  23. var dbconn1 = bdbconn.Get(dbconn.ToGuid());
  24. if (bdbconn.TestSql(dbconn1, sql))
  25. {
  26. context.Response.Write("SQL语句测试正确");
  27. }
  28. else
  29. {
  30. context.Response.Write("SQL语句测试错误");
  31. }
  32. }
  33. public bool IsReusable
  34. {
  35. get
  36. {
  37. return false;
  38. }
  39. }
  40. }
  41. }