資源簡介
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.xm
?????文件??????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.xm
?????文件??????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個文件信息
評論
共有 條評論