在文件夹BusinessLogicLayer放了DataAccessLayer.cs代码如下:
using System;
using System.Collections;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Diagnostics;
using System.ComponentModel;
namespace WebSite1.DataAcessLayer
{
    public class Database : IDissposable
    {
        protected SqlConnection Connection;        protected String ConnectionString;        public Database()
        {
           ConnectionString = ConfigurationSettings.AppSettings["DBConnectionString"];
        }        ~Database()
        {
            try
            {
                if (Connection != null)
                {
                    Connection.Close();
                }
            }catch { }
            try
            {            }
            catch{ }
        }
        protected void open() 
        { 
            if(Connection == null)
            {
                Connection = new SqlConnection(ConnectionString);
            }
            if(Connection.State.Equals(ConnectionState.Closed))
            {
                Connection.Open();
            }
        }
        public void Close() 
        {
            if (Connection != null)
            {
                Connection.Close();
            }
        }
        public void Dispose()
        { 
            if(Connection !=null)
            {
                Connection.Dispose();
                Connection = null;
            }
        }
        public int ExecuteSQL(String SqlString)
        {
            int count = -1;
            Open();
            try
            {
                SqlCommand cmd = new SqlCommand(SqlString, Connection);
                count = cmd.exectenonquery();            }
            catch
            {
                count = -1;            }
            finally
            {
                Close();
            }
            return count;
        }
        public DataSet GetDataSet(String SqlString) 
        {
            open();
            SqlDataAdapter adapter = new SqlDataAdapter(SqlString, Connection);
            DataSet dataset = new DataSet();
            adapter.Fill(dataset);
            Close();
            return dataset;
            
        }
        public DataRoow GetDAtaRow(String SqlString) 
        {
            DataSet dataset = GetDataSet(SqlString);
            dataset.casesitive = false;
            if(dataset.Tables[0].Rows.Count>0)
            {
                return dataset.Tables[0].Rows[0];
            }
            else
            {
                return null;
            }
        }    }
}
我在文件夹BusinessLogicLayer放了User.cs代码如下:
using System;
using System.Data;using WebSite1.DataAccessLayer;
namespace WebSite1.BusinessLogicLayer
{
    public class User 
    {
        private string _userName;
        private string _password;        private  bool _exist;        public string UserName
        {
            set
            {
                this._userName = value;
            }
            get
            {
                return this._userName;
            }
        }        public string password
        {
            set
            {
                this._password = value;
            
            }
            get 
            {
                return this._password;
            }
        }        public bool Exist
        {
            get
            {
                return this._exist;
            }
        }
        public void LoadData(string userName)
        {
            Database db = new Database();
            string sql = "select * from [User] where UserName = '" + userName + "'";
            DataRow dr = db.GetDataRow(sql);
            if (dr != null)
            {
                this._userName = dr["UserName"].ToString();
                this._password = dr["Password"].ToString();
            }
            else
                this._exist = false;        }
        public void Add(string username, string password)
        {
            Database db = new Database();
            string sql= "insert into [User] values("+"'"+username+"',"+"'"+password+"')";
            db.ExecuteSQL(sql);
        }
    }
}
问题:为什么不能引用到Database.cs类???