VS 2005数据连接错误
一:public Database()
{
ConnectionString = ConfigurationSettings.AppSettings["DBConnectionString"].ToString ();
}
二: protected void Open()
{
if (Connection == null)
{
Connection = new SqlConnection(ConnectionString);
}
if (Connection.State.Equals(ConnectionState.Closed))
{
Connection.Open();
}
以上都是在数据访问层中编写的方法,出现了以下错语:
警告 1 “System.Configuration.ConfigurationSettings.AppSettings”已过时:“This method is obsolete, it has been replaced by System.Configuration!System.Configuration.ConfigurationManager.AppSettings” C:\MyChatRoom\App_Code\DataAccessLayer\Database.cs 28 32 C:\MyChatRoom\
错误 2 无法将类型“string”隐式转换为“System.Data.SqlClient.SqlConnection” C:\MyChatRoom\App_Code\DataAccessLayer\Database.cs 28 32 C:\MyChatRoom\
错误 3 与“System.Data.SqlClient.SqlConnection.SqlConnection(string)”最匹配的重载方法具有一些无效参数 C:\MyChatRoom\App_Code\DataAccessLayer\Database.cs 70 30 C:\MyChatRoom\
错误 4 参数“1”: 无法从“System.Data.SqlClient.SqlConnection”转换为“string” C:\MyChatRoom\App_Code\DataAccessLayer\Database.cs 70 48 C:\MyChatRoom\