最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
asp.net 数据库访问组件支持Using
时间:2022-06-25 06:51:24 编辑:袖梨 来源:一聚教程网
调用代码
private void testusing()
{
using (idbhelper dbhelper = new sqlhelper(basesysteminfo.usercenterdbconnection))
{
dbhelper.executenonquery(" select getdate() ");
}
}
源代码。
//------------------------------------------------------------
// all rights reserved , copyright (c) 2010 , jirisoft , ltd.
//------------------------------------------------------------using system;
using system.data;
using system.data.common;
using system.io;
using system.text;namespace dotnet.dbutilities
{
using dotnet.utilities;///
/// basedbhelper
/// 有关数据库教程连接的方法。
///
/// 修改纪录
///
/// 2011.01.29 版本:3.1 jirigala 实现idisposable接口。
/// 2010.06.13 版本:3.0 jirigala 改进为支持静态方法,不用数据库open、close的方式,autoopenclose开关。
/// 2010.03.14 版本:2.0 jirigala 无法彻底释放、并发时出现异常问题解决。
/// 2009.11.25 版本:1.0 jirigala 改进connectionstring。
///
/// 版本:3.1
///
///
///jirigala
///2011.01.29
///
///
public abstract class basedbhelper : idisposable // idbhelper
{代码省略
public void dispose()
{
this.dbcommand = null;
this.dbdataadapter = null;
this.dbtransaction = null;
// 关闭数据库连接
if (this.dbconnection != null)
{
if (this.dbconnection.state != connectionstate.closed)
{
this.dbconnection.close();
}
}
this.dbconnection = null;
}
}
}
相关文章
- 群英风华录中神兽饕餮有啥技能 08-24
- 时光杂货店收入提升的做法有哪些 时光杂货店提升收入攻略 08-24
- 时光杂货店名人堂如何用 时光杂货店名人堂玩法分享 08-24
- 小米路由器6609如何打开(小米路由器6609打开方法) 08-24
- ARCRaiders单人如何通关收割者 08-24
- 时光杂货店产业有哪些 时光杂货店产业分布情况说明 08-24