数据库助手类 DBHelper】的更多相关文章

using System; using System.Collections.Generic; using System.Text; using System.Configuration; using System.Data; using System.Data.SqlClient; using System.Reflection; /// <summary> /// 数据库助手 /// @浅时光 /// #zuxuguang@163.com /// </summary> name…
using System; using System.Collections.Generic; using System.Configuration; using System.Data; using System.Data.SqlClient; using System.Text; namespace YcTools { /// <summary>C# SQL数据库助手类2.0</summary> public class YSqlHelper { //Sql连接语句 /*注意引…
一.前言 相信许多人都百度过:“.net 数据库访问类”.然后就出来一大堆SqlHelper.我也用过这些SqlHelper,也自己写过,一堆静态方法,开始使用起来感觉很不错,它们也确实在很多时候可以很好的工作.ADO.NET已经封装很好了,我们很容易就可以实现自己的数据库访问类. 很久前,忘记在哪里看到过了,有一个朋友写了一篇[如何做一个好用的数据库访问类](有兴趣的朋友仍然可以搜索到),这篇文章确实写得很好,作者很详细的讲解了如何设计一个好的数据库访问类:所谓“好“是指:轻量.易用.通用.高…
一.前言 相信许多人都百度过:“.net 数据库访问类”.然后就出来一大堆SqlHelper.我也用过这些SqlHelper,也自己写过,一堆静态方法,开始使用起来感觉很不错,它们也确实在很多时候可以很好的工作.ADO.NET已经封装很好了,我们很容易就可以实现自己的数据库访问类. 很久前,忘记在哪里看到过了,有一个朋友写了一篇[如何做一个好用的数据库访问类](有兴趣的朋友仍然可以搜索到),这篇文章确实写得很好,作者很详细的讲解了如何设计一个好的数据库访问类:所谓“好“是指:轻量.易用.通用.高…
这是一个与C# .NET通用的数据库访问类,包含了工厂模式.事务处理等安全机制. 调用方式: DBHelper db = new DBHelper(); DbCommand cmd = db.GetSqlStringCommond(sql); return (int)db.ExecuteScalar(cmd, parameters); SqlParameter[] parameters = { new SqlParameter("@TMember_Id", model.TMember_…
项目需要,需要一个通用的数据库操作类,增删改查.事务.存储过程.日志记录都要有,于是在已有的帮助类上做了一些改进,并将log4j的.NET版--log4net嵌入其中记录sql的执行环境和状态. 用起来还是比较顺手的,因此分享一下供参考.其中log4net需要通过VS的NuGet程序包管理器引入然后引用. 1. LogHelper: using log4net; using log4net.Layout; using System.Collections.Generic; namespace C…
using System; using System.Collections.Generic; using System.Text; using System.Configuration; using System.Data; using System.Data.SqlClient; namespace Erp.DBUtility { public class YSqlHelper { //Sql连接语句 private static string connectionString = Conf…
SQL语句操作增删查改助手类 using System; using System.Collections.Generic; using System.Configuration; using System.Data; using System.Data.SqlClient; using System.Text; namespace Ecio_Admin { /// <summary>SQL数据库助手类</summary> public class SqlHelper { //Sq…
/// <summary> /// 数据库帮助类 /// <author>vito</author> /// </summary> public class DBHelper { 8 /// <summary> /// 数据库连接字符串 /// </summary> private string connStr = System.Configuration.ConfigurationManager.AppSettings["…
本文章为原创内容,如需转载,请注明作者及出处,谢谢! 一.在System.Data.Common命名空间下,存在这样的一个类: // // 摘要: // 表示一组方法,这些方法用于创建提供程序对数据源类的实现的实例. public abstract class DbProviderFactory { // // 摘要: // 初始化 System.Data.Common.DbProviderFactory 类的新实例. protected DbProviderFactory(); // // 摘…