国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

自己創建非托管的資源,c#內存自己管理-

2024-07-21 02:26:57
字體:
來源:轉載
供稿:網友
  • 本文來源于網頁設計愛好者web開發社區http://www.html.org.cn收集整理,歡迎訪問。
  • public class intro:idisposable
     {
      private oledbconnection conn;
      private oledbcommand cmd;
      private string introcontent;

      public intro()
      {
       conn=dbconnection.getconn();
       conn.open();
       cmd=new oledbcommand("select top 1 * from [intro]",conn);
       try
       {
        oledbdatareader dr=cmd.executereader();
        dr.read();
        introcontent=dr.getvalue(1).tostring();
       }
       catch
       {
        introcontent="";
       }
       finally
       {
        cmd.dispose();
        conn.close();
       }
      } 

     public void dispose()
      {
       if(conn.state==connectionstate.open)
        conn.close();
       conn.dispose();
       gc.suppressfinalize(this);
      }

    }

    調用是-------

    using(intro it=new intro())
       {

       }

    發表評論 共有條評論
    用戶名: 密碼:
    驗證碼: 匿名發表
    主站蜘蛛池模板: 正宁县| 礼泉县| 娱乐| 奎屯市| 繁昌县| 讷河市| 苍山县| 互助| 盱眙县| 洪洞县| 辽阳县| 盐亭县| 永昌县| 华宁县| 达州市| 卢氏县| 邓州市| 朝阳区| 曲水县| 合山市| 东阿县| 林周县| 岫岩| 湖州市| 百色市| 原平市| 闻喜县| 鄂托克前旗| 罗江县| 岳阳市| 新乡市| 白朗县| 孟津县| 得荣县| 鲁甸县| 邯郸市| 公安县| 永川市| 新宾| 尖扎县| 牟定县|