(三层结构)ASP.NET数据库连接问题?
数据库连接问题?ApplicationConfig.cs
namespace LIBRARYMSBLL
{
public class ApplicationConfig
{
public static string ConnectionString()
{
return "Data Source=.;Initial Catalog=LibraryMS;User ID=sa;Password=123; Connection Reset=FALSE;max pool size=500;min pool size=5" providerName="System.Data.SqlClient";
}
public static string UpdateCache()
{
return "Data Source=.;Initial Catalog=LibraryMS;User ID=sa;Password=123; Connection Reset=FALSE;max pool size=500;min pool size=5" providerName="System.Data.SqlClient";
}
}
}
BookBLL.cs
public BookBLL()
{
connection = new SqlConnection();
connection.ConnectionString = ApplicationConfig.ConnectionString();
try
{
connection.Open();
selfConn = true;
}
catch
{
connection.ConnectionString = ApplicationConfig.UpdateCache();
connection.Open();
selfConn = true;
}
finally
{
dal = new BookDAL(connection, transaction);
}
}
web.config
<add name="LibraryMSConnectionString" connectionString="Data Source=.;Initial Catalog=LibraryMS;User ID=sa;Password=123; Connection Reset=FALSE;max pool size=500;min pool size=5" providerName="System.Data.SqlClient" />
<add name="LIBRARYMSConnectionString1" connectionString="Data Source=.;Initial Catalog=LibraryMS;User ID=sa;Password=123; Connection Reset=FALSE;max pool size=500;min pool size=5" providerName="System.Data.SqlClient" />
错误提示:
在建立与服务器的连接时出错。在连接到 SQL Server 2005 时,在默认的设置下 SQL Server 不允许进行远程连接可能会导致此失败。 (provider: SQL 网络接口, error: 26 - 定位指定的服务器/实例时出错)
还有个问题
上面的BLL DAL Model web 在不通的目录 ,他们是如何联系起来的呢?
哪位高手能详细解答下吗? 谢谢