• 大小: 4.04MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-10-14
  • 语言: C#
  • 标签: ASP.NET  

资源简介

ASP.NET三层架构网站源代码ASP.NET三层架构网站源代码ASP.NET三层架构网站源代码ASP.NET三层架构网站源代码ASP.NET三层架构网站源代码

资源截图

代码片段和文件信息

using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;

namespace NBBS.DALHelper
{
    /// 
    /// 数据访问层辅助类——SQLServer
    /// 密封类,不可继承
    /// 仅包含静态方法,不需实例化直接使用(也可使用Singleton模式)
    /// 

    public sealed class SQLServerHelper
    {
        /// 
        /// 用于连接SQLServer数据库的连接字符串,存于Web.config中
        /// 

        private static readonly string _sqlConnectionString = ConfigurationManager.AppSettings[“SQLServerConnectionString“];

        /// 
        /// 执行SQL命令,不返回任何值
        /// 

        /// SQL命令
        public static void ExecuteSQLNonQurey(string sql)
        {
            SqlConnection connection = new SqlConnection(_sqlConnectionString);
            SqlCommand command = new SqlCommand(sqlconnection);
            connection.Open();
            command.ExecuteNonQuery();
            connection.Close();
        }

        /// 
        /// 执行SQL命令,并返回SqlDataReader
        /// 

        /// SQL命令
        /// 包含查询结果的SqlDataReader
        public static SqlDataReader ExecuteSQLReader(string sql)
        {
            SqlConnection connection = new SqlConnection(_sqlConnectionString);
            SqlCommand command = new SqlCommand(sql connection);
            connection.Open();
            SqlDataReader sqlReader = command.ExecuteReader();
            //connection.Close();

            return sqlReader;
        }

        /// 
        /// 执行存储过程,不返回任何值
        /// 

        /// 存储过程名
        /// 参数
        public static void ExecuteProcedureNonQurey(string storedProcedureNameIDataParameter[] parameters)
        {
            SqlConnection connection = new SqlConnection(_sqlConnectionString);
            SqlCommand command = new SqlCommand(storedProcedureNameconnection);
            command.CommandType = CommandType.StoredProcedure;
            if (parameters != null)
            {
                foreach (SqlParameter parameter in parameters)
                {
                    command.Parameters.Add(parameter);
                }
            }
            connection.Open();
            command.ExecuteNonQuery();
            connection.Close();
        }

        /// 
        /// 执行存储,并返回SqlDataReader
        /// 

        /// 存储过程名
        /// 参数
        /// 包含查询结果的SqlDataReader
        public static SqlDataReader ExecuteProcedureReader(string storedProcedureNameIDataParameter[] parameters)
        {
            SqlConnection connection = new SqlConnection(_sqlConnectionString);
            SqlCommand command = new SqlCommand(storedProcedureNameconnection);
            command.Com

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      16384  2008-05-28 15:06  NBBS\NBBS\DALHelper\bin\Debug\NBBS.DALHelper.dll

     文件      13824  2008-05-28 15:06  NBBS\NBBS\DALHelper\bin\Debug\NBBS.DALHelper.pdb

     文件      16384  2008-05-29 15:59  NBBS\NBBS\DALHelper\bin\Release\NBBS.DALHelper.dll

     文件      13824  2008-05-29 15:59  NBBS\NBBS\DALHelper\bin\Release\NBBS.DALHelper.pdb

     文件       2186  2008-05-28 15:06  NBBS\NBBS\DALHelper\DALHelper.csproj

     文件        514  2008-07-18 15:53  NBBS\NBBS\DALHelper\obj\DALHelper.csproj.FileListAbsolute.txt

     文件      16384  2008-05-28 15:06  NBBS\NBBS\DALHelper\obj\Debug\NBBS.DALHelper.dll

     文件      13824  2008-05-28 15:06  NBBS\NBBS\DALHelper\obj\Debug\NBBS.DALHelper.pdb

     文件      16384  2008-05-29 15:59  NBBS\NBBS\DALHelper\obj\Release\NBBS.DALHelper.dll

     文件      13824  2008-05-29 15:59  NBBS\NBBS\DALHelper\obj\Release\NBBS.DALHelper.pdb

     文件       1413  2008-04-12 14:13  NBBS\NBBS\DALHelper\Properties\AssemblyInfo.cs

    ....SHR       102  2008-05-28 15:05  NBBS\NBBS\DALHelper\Properties\vssver2.scc

     文件       4788  2008-04-16 21:18  NBBS\NBBS\DALHelper\SQLServerHelper.cs

     文件      20480  2008-05-28 15:06  NBBS\NBBS\Entity\bin\Debug\NBBS.Entity.dll

     文件        490  2008-05-11 22:50  NBBS\NBBS\Entity\bin\Debug\NBBS.Entity.dll.VisualState.xml

     文件      40448  2008-05-28 15:06  NBBS\NBBS\Entity\bin\Debug\NBBS.Entity.pdb

     文件        743  2008-05-11 22:49  NBBS\NBBS\Entity\bin\Debug\TestResult.xml

     文件      20480  2008-05-29 15:59  NBBS\NBBS\Entity\bin\Release\NBBS.Entity.dll

     文件      34304  2008-05-29 15:59  NBBS\NBBS\Entity\bin\Release\NBBS.Entity.pdb

     文件       1582  2008-05-08 09:58  NBBS\NBBS\Entity\BoardInfo.cs

     文件       2288  2008-05-28 15:06  NBBS\NBBS\Entity\Entity.csproj

     文件        821  2008-05-08 11:03  NBBS\NBBS\Entity\LoginInfo.cs

     文件        812  2008-05-13 14:37  NBBS\NBBS\Entity\MotherBoardInfo.cs

     文件      20480  2008-05-28 15:06  NBBS\NBBS\Entity\obj\Debug\NBBS.Entity.dll

     文件      40448  2008-05-28 15:06  NBBS\NBBS\Entity\obj\Debug\NBBS.Entity.pdb

     文件       2504  2008-05-07 22:04  NBBS\NBBS\Entity\obj\Debug\ResolveAssemblyReference.cache

     文件        150  2008-04-10 22:03  NBBS\NBBS\Entity\obj\Entity.csproj.FileList.txt

     文件        460  2008-07-18 15:53  NBBS\NBBS\Entity\obj\Entity.csproj.FileListAbsolute.txt

     文件      20480  2008-05-29 15:59  NBBS\NBBS\Entity\obj\Release\NBBS.Entity.dll

     文件      34304  2008-05-29 15:59  NBBS\NBBS\Entity\obj\Release\NBBS.Entity.pdb

............此处省略944个文件信息

评论

共有 条评论