//===============================================================================// This file is based on the Microsoft Data Access Application Block ...
分类:
数据库 时间:
2015-02-01 14:44:25
阅读次数:
214
1.数据操作封装1.1概述在习惯使用ADO.NET数据库访问与操作封装,通常写DataHelper/SQLHelper类。到如今ORM大行其道,我们该爱上存储库模式来封装操作。当然,为了顾及初学者,在封装方法时,还是教学方式,一步步地来,最终重构成通用可重用的代码。所以一开始先不用泛型及写一些扩展方...
分类:
Web程序 时间:
2015-01-26 16:48:00
阅读次数:
192
1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Web; 5 using System.Data.SqlClient; 6 using System.Data...
分类:
数据库 时间:
2015-01-23 16:01:51
阅读次数:
357
staticstringstr="server=ETPWQO7ANIFO8OJ\\SQLEXPRESS;database=test-1;uid=ss;pwd=123456";publicstaticList<T2>ExcuteList<T2>(stringstrcmd,paramsSqlParameter[]paras){using(SqlConnectionconn=newSqlConnection(str)){SqlDataAdapterda=newSqlDataAdapter(s..
分类:
数据库 时间:
2015-01-20 18:20:07
阅读次数:
160
今天复习了一次ADO.NET基础,整理一下自己的认为的重点:编写SqlHelper类,方便我们执行数据库语句,这时可以直接调用封装在SqlHelper类的方法。现在大多数公司面试的时候,给你的面试题都会要你自己手写一个SqlHelper的类,这考的是自己的基本功,如果一个根基不牢固的开发人员,你写的...
分类:
数据库 时间:
2015-01-19 20:46:02
阅读次数:
232
// ExecuteNonQuery 构建public static int ExecuteNonQuery(string sql,params SqlParameter[] parameters){ string Str = ConfigurationManager.ConnectionStrin...
分类:
数据库 时间:
2015-01-13 17:31:20
阅读次数:
275
用于MySql的SqlHelper 1 /// 2 3 /// Title :MySqlHelper 4 /// Author :WinterT 5 /// Date :2015-1-8 08:12:54 6 /// Descriptio...
分类:
数据库 时间:
2015-01-09 17:02:51
阅读次数:
189
代码 Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->using System;using System.Collections.Generic;usi...
分类:
数据库 时间:
2015-01-08 19:57:27
阅读次数:
248
usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Data;usingSystem.Data.SqlClient;namespaceDataController{stat...
分类:
数据库 时间:
2015-01-07 22:01:20
阅读次数:
177
在重构的时候,用到了一个很重要的数据库操作组件—SqlHelper。
--SqlHelper
SqlHelper是一个基于·NET Framework的数据库操作组件。组件中包含数据库操作方法。SqlHelper用于简化你重复的去写那些数据库连接(SqlConnection),SqlCommand,SqlDataReader等等。SqlHelper 封装过后通常是只需要给方法传入一些参数如数据...
分类:
数据库 时间:
2015-01-04 21:24:31
阅读次数:
260