//版权所有 OSLEAGUE 2002-2003
//作者:Blood
using System;
using System.Data;
using System.Data.SqlClient;
using System.Web;
using OSLeagueForumXP.Components;
namespace OSLeagueForumXP.Common
{
/// <summary>
/// 数据库操作通用类
/// </summary>
public class DataBase : IDisposable
{
/// <summary>
/// 数据库连接源
/// </summary>
private SqlConnection SqlConn;
/// <summary>
/// 运行SQL Server储存过程
/// </summary>
/// <param name="ProcedureName">储存过程名称</param>
/// <returns>储存过程返回的值</returns>
public int RunProcedure(string ProcedureName)
{
SqlCommand Sqlcmd = CreateCommand(ProcedureName, null);
Sqlcmd.ExecuteNonQuery();
this.Close();
return (int)Sqlcmd.Parameters["ReturnValue"].Value;
}
/// <summary>
/// 运行SQL Server储存过程
/// </summary>
/// <param name="ProcedureName">储存过程名称</param>
/// <param name="SqlPrams">储存过程参数</param>
/// <returns>储存过程返回值</returns>
public int RunProcedure(string ProcedureName, SqlParameter[] SqlPrams)
{
SqlCommand Sqlcmd = CreateCommand(ProcedureName, SqlPrams);
Sqlcmd.ExecuteNonQuery();
this.Close();
return (int)Sqlcmd.Parameters["ReturnValue"].Value;
}
/// <summary>
/// 运行SQL Server储存过程
/// </summary>
/// <param name="ProcedureName">储存过程名称</param>
/// <param name="SqlReader">以SqlDataReader返回储存过程结果</param>
public void RunProcedure(string ProcedureName, out SqlDataReader SqlReader)
{