最新下载
热门教程
- 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;
}
}
}
相关文章
- ps怎么给图片描边?ps给卡通汽车图片描边教程 07-06
- 迷雾大陆兑换码在哪里输入-迷雾大陆兑换码2025 07-06
- 欧易okx官网app下载_欧易okx官网入口 07-06
- 在JSP页面中动态生成图片验证码的方法实例 07-06
- 魔塔50层怎么通关-魔塔50层超详细攻略 07-06
- 使用JSP实现简单的用户登录注册页面示例代码解析 07-06