人人做人人澡人人爽欧美,国产主播一区二区,久久久精品五月天,羞羞视频在线观看免费

當前位置:蘿卜系統下載站 > 技術開發教程 > 詳細頁面

ASP.NET 2.0里簡單取得數據庫連接統計數據

ASP.NET 2.0里簡單取得數據庫連接統計數據

更新時間:2022-07-29 文章作者:未知 信息來源:網絡 閱讀次數:

    ASP.NET 2.0中的SqlConnection多了一個StatisticsEnabled屬性和ResetStatistics()、RetrieveStatistics()兩個方法,用于獲取SQLServer的連接統計數據。

<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ page language="C#" %>
<script runat="server">
    void Page_Load(object sender, EventArgs e)
    {
        string connString = "Northwind的連接串";
        SqlConnection conn = new SqlConnection(connString);
        conn.StatisticsEnabled = true;
        conn.ResetStatistics();
        conn.Open();
        SqlCommand cmd = new SqlCommand("SELECT * FROM Orders", conn);
        SqlDataReader reader = cmd.ExecuteReader();
        reader.Close();
        conn.Close();

        Hashtable ht = (Hashtable)conn.RetrieveStatistics();
        foreach (string key in ht.Keys)
        {
            Label1.Text += "Key: " + key + " = " + ht[key] + "<BR />";
        }
    }
</script>
<html>
<head id="Head1" runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="Form1" runat="server" autocomplete="on">
        <asp:Label ID="Label1" Runat="server" Text=""></asp:Label>
    </form>
</body>
</html>

運行后的結果就是SQLServer連接統計數據結果:

Key: NetworkServerTime = 0
Key: BytesReceived = 156913
Key: UnpreparedExecs = 1
Key: SumResultSets = 1
Key: SelectCount = 1
Key: PreparedExecs = 0
Key: ConnectionTime = 30
Key: ExecutionTime = 30
Key: Prepares = 0
Key: BuffersSent = 1
Key: SelectRows = 830
Key: ServerRoundtrips = 1
Key: CursorOpens = 0
Key: Transactions = 0
Key: BytesSent = 48
Key: BuffersReceived = 20
Key: IduRows = 0
Key: IduCount = 0

溫馨提示:喜歡本站的話,請收藏一下本站!

本類教程下載

系統下載排行

網站地圖xml | 網站地圖html
主站蜘蛛池模板: 科技| 景德镇市| 博白县| 东山县| 福清市| 安宁市| 拜泉县| 宜兴市| 静乐县| 九龙城区| 永济市| 团风县| 石泉县| 三台县| 高淳县| 湄潭县| 大埔县| 新沂市| 寿光市| 明星| 齐河县| 墨脱县| 新昌县| 荔浦县| 凌海市| 苏州市| 五大连池市| 苍溪县| 利川市| 义马市| 察哈| 镇赉县| 南陵县| 南阳市| 定南县| 聊城市| 三江| 楚雄市| 赤水市| 三门峡市| 合水县|