文档下载 文档下载导航
设为首页 | 加入收藏
搜索 请输入内容:  
 导航当前位置: 文档下载 > 所有分类 > 工程科技 > 电子/电路 > 微软的SQLHELPER类
侵权投诉

微软的SQLHELPER类

微软的SQLHelper类

1. using System;

2. using System.Data;

3. using System.Xml;

4. using System.Data.SqlClient;

5. using System.Collections;

6. namespace Book.DAL

7. {

8. /// <summary>

9. /// SqlServer数据访问帮助类

10. /// </summary>

11. public sealed class SqlHelper

12. {

13. #region 私有构造函数和方法

14. private SqlHelper() {}

15. /// <summary>

16. /// 将SqlParameter参数数组(参数值)分配给SqlCommand命令.

17. /// 这个方法将给任何一个参数分配DBNull.Value;

18. /// 该操作将阻止默认值的使用.

19. /// </summary>

20. /// <param name="command">命令名</param>

21. /// <param name="commandParameters">SqlParameters数组</param>

22. private static void AttachParameters(SqlCommand command, SqlParameter[] commandParameters)

23. {

24. if( command == null ) throw new ArgumentNullException( "command" );

25. if( commandParameters != null )

26. {

27. foreach (SqlParameter p in commandParameters)

28. {

29. if( p != null )

30. {

31. // 检查未分配值的输出参数,将其分配以DBNull.Value.

32. if ( ( p.Direction == ParameterDirection.InputOutput || p.Direction == ParameterDirection.Input ) &&

33. (p.Value == null))

34. {

35. p.Value = DBNull.Value;

36. }

37. command.Parameters.Add(p);

38. }

39. }

40. }

41. }

42.

第1页

你可能喜欢

热门文档

相关文档

  • 微软SqlHelper类(中文版)中的方法及说明整理,帮助新手...

    微软SqlHelper类(中文版)中的方法及说明整理,帮助新手认识这个类文件 (后附SqlHelper类(中文版))_计算机软件及应用_IT/计算机_专业资料。微软SqlHelper类(中文版...

  • 微软SqlHelper类中文注释和使用方法

    微软SqlHelper类中文注释和使用方法_IT/计算机_专业资料。微软 SqlHelper 类中文注释和使用方法整理:飞晏博客;网址:http://www.feiyan.info/416.html。 和微软...

  • 微软SqlHelper中方法列表

    微软SqlHelper中方法列表_理学_高等教育_教育专区。SqlHelper方法列表本文章主要介绍 SqlHelper 使用。 每个项目都要用到数据访问层,我做的也不例外,但是我把数据...

  • SqlHelper 类实现详细信息

    SqlHelper体验谈: 以下载自CEOCIO(MVP/CSDN_WEB开发版主)的Blog: 微软提供的Data Access Application Block中的SQLHelper类中封装了最常用的数据操作,各个使用者...

  • 微软提供的数据访问组件SqlHelper

    微软提供的数据访问组件SqlHelper_IT/计算机_专业资料。微软提供的数据访问组件SqlHelper数据访问组件是一组通用的访问数据库的代码,在所有项目中都可以用,一般不需要...

  • 应用sqlhelper的例子

    应用sqlhelper的例子_计算机软件及应用_IT/计算机_专业资料。应用SqlHelper例子(... 微软的SQLHelper类(含完... 43页 免费 SQLhelper 39页 免费 最全的SQL...

  • 自己写的SqlHelper类

    自己写的SqlHelper类_计算机软件及应用_IT/计算机_专业资料。方法重载,支持参数... SqlHelper类的方法 17页 免费 SQLHelper类 12页 免费 微软SqlHelper类中文...

  • 中文解释的SqlHelper.cs类

    中文解释的SqlHelper.cs类_计算机软件及应用_IT/计算机_专业资料。中文解释的 ... 微软的SQLHelper类(含完... 43页 7下载券 微软的SQLHelper类(含完... ...

  • SqlHelper类

    SqlHelper类_计算机软件及应用_IT/计算机_专业资料。C# SqlHelper类... 微软SqlHelper类中文注释... 63页 1下载券 SQLHelper类 43页 免费 自己写...

站点地图 | 文档上传 | 侵权投诉 | 手机版
本站所有资源均来自互联网,本站只负责收集和整理,均不承担任何法律责任,如有侵权等其它行为请联系我们.
文档下载 Copyright 2013 doc.guandang.net All Rights Reserved.  -  email