zoukankan      html  css  js  c++  java
  • 获取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);
    }

  • 相关阅读:
    POJ 3630
    Codeforces Round #219 (Div. 2) D题
    Codeforces Round #232 (Div. 2) On Sum of Fractions
    Codeforces Round #232 (Div. 2) C
    撸呀撸的左手(KMP+DP)
    hdu poj KMP简单题目总结
    LCT总结
    bzoj1019 [SHOI2008]汉诺塔
    NOIP2016总结
    p1199八数码问题
  • 原文地址:https://www.cnblogs.com/Yellowshorts/p/2914588.html
Copyright © 2011-2022 走看看