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);
}