日期:2010-06-09  浏览次数:20622 次

using System;
using System.IO;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;

namespace SQLServerBase
{
    /// <summary>
    ///内部类:存储过程的返回值记录类
    /// </summary>
    public class SqlResult
    {       
        public bool Succeed;            //存储过程是否执行成功.
        public Hashtable OutputValues;    // 存储过程output值,放在(HashTable)表OutputValues里.           
        public DataTable datatable;        //存储过程返回的结果集,放在(DataTable)表datatable里.
        public DataSet dataSet;            //存储过程返回的结果集,放在DataSet表中
        public string errorMessage;        //访问数据库失败
        public int inflecntNum;
        public SqlResult()
        {
            Succeed = false;
            OutputValues = new Hashtable();
            datatable=new DataTable();
            dataSet=new DataSet();
            errorMessage = "";
        }
    }
    /// <summary>
    /// ====================***调用存储过程和SQL的基类***============================
    /// abstract:该类不能被实例化,只能通过派生子类来使用它
    /// </summary>
    public abstract class SpSQL_base : IDisposable
    {
        public SpSQL_base() : this("","")
        {
        }
        //重载
        public SpSQL_base(string sp_name,string sql_name)
        {
            this.ProcedureName = sp_name;
            this.SQLName = sql_name;
        }
        //私有成员变量
        private string sp_name;
        private string sql_name;
        private SqlConnection myConnection;
        private SqlCommand myCommand;
        private SqlParameter myParameter;//存储过程参数
       
        //公共属性
        public string ProcedureName//获取和设置存储过程名
        {
            get
            {
                return this.sp_name;
            }
    &nb