• 获取SqlConnection的统计信息


      var MyConnectionString = @"Data Source=.;Initial Catalog=BalloonShop;Integrated Security=True";
    using (SqlConnection Myconnection = new SqlConnection(MyConnectionString))
    {
       Myconnection.StatisticsEnabled = true;//启用信息收集
       var MySql = "select * from Category";
          var MyAdapter = new SqlDataAdapter(MySql, Myconnection);
       var MyDateSet = new DataSet();
       Myconnection.Open();
       MyAdapter.Fill(MyDateSet, "adsfasdfa");
          System.Collections.IDictionary MyStatistics = Myconnection.RetrieveStatistics();//获取信息
       long byteReceived = (long)MyStatistics["BytesReceived"];
       long selectRows = (long)MyStatistics["SelectRows"];
       var MyInfo = "当前连接部分统计如下:";
       MyInfo += "已经接受到的字节数" + byteReceived.ToString();
       MyInfo += "查询已经或得的行数" + selectRows.ToString();
      Response.Write(MyInfo);
    }

  • 相关阅读:
    spring boot(二)web综合开发
    spring boot(一)入门
    shiro中单点登录
    shiro中SSL
    shiro中记住我功能
    spring中集成shiro
    OpenResty
    源代码安全审计
    Mycat读写分离 + 主从复制(Gtid)
    关于ansbile
  • 原文地址:https://www.cnblogs.com/Yellowshorts/p/2914588.html
Copyright © 2020-2023  润新知