最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
asp.net 数据库访问组件支持Using
时间:2011-02-04 编辑:简简单单 来源:一聚教程网
调用代码
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;
}
}
}
-
上一个: Asp.net Mvc分页方法介绍
相关文章
- asp.net数据库操作常见问题 06-24
- asp.net 批量向数据库高效插入数据的方法 06-23
- ASP.NET/Perl.NET 数据库访问例子 01-12
- C#复制数组的两种方式及效率比较解读 10-24
- ASP.NET Identity用法解析 10-24
- ASP.NET MVC使用Identity增删改查用户介绍 10-24