自己前面写过一篇博客是关于Ado.net和数据库的但是自己并没有怎么注意直到机房重构的时候发现其实好多东西封装起来可以减少DAL层的代码量没错啦这就是我在读了很多前人的博客和峰哥借的书之后明白的sqlhelper之前看大家很多人一直在写关于这方面的博客然后自己没有太注意,一直以为他是一个配置文件直接拿来就可以用的觉得他很高大上但是自己开始动手做之后才发现原来他其实就是我们在对数据库进行操作的时候会...
分类:
数据库 时间:
2015-01-02 12:18:40
阅读次数:
225
import java.sql.Connection;import java.sql.DriverManager;import java.sql.ResultSet;import java.sql.SQLException;import java.sql.PreparedStatement;/** ...
分类:
数据库 时间:
2014-12-28 15:25:21
阅读次数:
214
SQLhelper助手类编写: 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using System.Threading.Tasks; 6 7 usi....
分类:
Web程序 时间:
2014-12-28 00:28:59
阅读次数:
219
我是通过spring和mybatis结合做的这个事情,通过spring去管理SqlHelper工具类
1:建立一个SqlHelper工具类,
2:类里面必须有一个属性SqlSessionFactory。
3:在你业务类里面,直接注入SqlHelper类,这样你就可以直接在你的业务类里面调用工具类,(工具类里面有好几个接口,自己可以根据实际情况适用)
4:在代码的最后我会贴一部分实例代...
分类:
数据库 时间:
2014-12-26 16:38:38
阅读次数:
269
原文地址:http://www.cnblogs.com/hongfei/archive/2012/07/07/2580994.html ? 假设我们需要写一个类用来操作数据库,并同时满足以下要求: ①SqlHelper类只能有一个实例(不能多) ②SqlHelper类必须能够自行创...
分类:
Web程序 时间:
2014-12-22 16:25:49
阅读次数:
236
public static class SqlHelper { public static readonly string connstr = ConfigurationManager.ConnectionStrings["connstr"].Connec...
分类:
数据库 时间:
2014-12-22 09:17:17
阅读次数:
120
随便找来的,源作者不明.本来是SQL SERVER 的 修改为 ODBC使用.并且修改了连接字符串,可以允许修改一次.using System;using System.Collections.Generic;using System.Linq;using System.Text;using Sys...
分类:
数据库 时间:
2014-12-15 23:28:16
阅读次数:
449
1,下载官方的DLL文件 System.Data.SQLite.dll 2,修改微软官方的SqlHelper,打造SQLiteHelper,改造方法很简单,批量替换方式
SqlConnection=》SQLiteConnection
SqlCommand=》SQLiteCommand
SqlPara...
分类:
数据库 时间:
2014-12-15 13:42:39
阅读次数:
265
namespace 操作数据{ class SqlHelper { public DataSet SqlTODs(string cmdstring) { DataSet ds = new DataSet(); try { string sqlstring = System.Configuration...
分类:
数据库 时间:
2014-12-12 23:29:00
阅读次数:
330
using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Configuration;using System.Data.SqlClient;using System.D...
分类:
数据库 时间:
2014-12-12 20:44:28
阅读次数:
174