제목 : [3][1] SQL Server 전용 DB 처리 : SqlDataProvider.cs
글번호:
|
|
304
|
작성자:
|
|
레드플러스
|
작성일:
|
|
2008/07/16 오전 10:48:00
|
조회수:
|
|
6027
|
using System;
using System.Data;
using Microsoft.Practices.EnterpriseLibrary.Data;//DAAB
namespace RedPlus.Modules.Memo
{
public class SqlDataProvider : DataProvider
{
private string _ConnectionString; // 필드
public string ConnectionString // 속성
{
get { return _ConnectionString; }
}
public SqlDataProvider() // 생성자
{
this._ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
}
public override void AddMemo(string Name, string Email, string Title, string PostIP)
{
DatabaseFactory.CreateDatabase("ConnectionString").ExecuteNonQuery("AddMemo", Name, Email, Title, PostIP);
}
public override IDataReader GetMemos(int Page)
{
return DatabaseFactory.CreateDatabase("ConnectionString").ExecuteReader("GetMemos", Page);
}
public override int GetTotalMemo()
{
return Convert.ToInt32(DatabaseFactory.CreateDatabase("ConnectionString").ExecuteScalar(CommandType.StoredProcedure, "GetTotalMemo"));
}
public override IDataReader FindMemos(string SearchField, string SearchQuery)
{
return DatabaseFactory.CreateDatabase("ConnectionString").ExecuteReader("FindMemos", SearchField, SearchQuery);
}
public override int GetTotalFindMemo(string SearchField, string SearchQuery)
{
return Convert.ToInt32(DatabaseFactory.CreateDatabase("ConnectionString").ExecuteScalar("GetTotalFindMemo", SearchField, SearchQuery));
}
public override IDataReader GetFindMemos(int intPage, string strSearchField, string strSearchQuery)
{
return DatabaseFactory.CreateDatabase("ConnectionString").ExecuteReader("GetFindMemos", intPage, strSearchField, strSearchQuery);
}
}
}