使用ConfigurationManager出现错误.
build时出现错误提示:C:\Users\a\Documents\VisualStudio2008\Projects\AJAXAlbum\AJAXAlbum\Class...
build时出现错误提示:C:\Users\a\Documents\Visual Studio 2008\Projects\AJAXAlbum\AJAXAlbum\Class1.cs(29,39): error CS0103: The name 'ConfigurationManager' does not exist in the current context
整个代码的连接:http://www.zhouqiming.com/asp/baiduC#.htm
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Configuration;
using System.Data.SqlClient;
using System.Data.Common;
using System.Globalization;
namespace ASPNETAJAXWeb.AjaxAlbum
{
public class AjaxAlbumSystem
{
public const string TOTALPAGEINDEX = "TOTALPAGEINDEX";
public const string CURRENTPAGEINDEX = "CURRENTPAGEINDEX";
public const int MAXPHOTOCOUNT = 4;
public static string[] ALLOWPHOTOFILELIST = new string[]{
".bmp",
".gif",
".jpg",
".mht",
".png"
};
public DataSet GetCatetorys()
{
string connectionString = ConfigurationManager.ConnectionStrings["SQLCONNECTIONSTRING"].ConnectionString;
SqlConnection con = new SqlConnection(connectionString);
string cmdText = "select * from Category";
SqlDataAdapter da = new SqlDataAdapter(cmdText, con);
DataSet ds = new DataSet();
try
{
con.Open();
da.Fill(ds, "DataTable");
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
finally
{
con.Close();
}
return ds;
}
上面的连接不对,是这个:http://www.zhouqiming.com/asp/baidu3%E4%BB%A3%E7%A0%81.htm 展开
整个代码的连接:http://www.zhouqiming.com/asp/baiduC#.htm
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Configuration;
using System.Data.SqlClient;
using System.Data.Common;
using System.Globalization;
namespace ASPNETAJAXWeb.AjaxAlbum
{
public class AjaxAlbumSystem
{
public const string TOTALPAGEINDEX = "TOTALPAGEINDEX";
public const string CURRENTPAGEINDEX = "CURRENTPAGEINDEX";
public const int MAXPHOTOCOUNT = 4;
public static string[] ALLOWPHOTOFILELIST = new string[]{
".bmp",
".gif",
".jpg",
".mht",
".png"
};
public DataSet GetCatetorys()
{
string connectionString = ConfigurationManager.ConnectionStrings["SQLCONNECTIONSTRING"].ConnectionString;
SqlConnection con = new SqlConnection(connectionString);
string cmdText = "select * from Category";
SqlDataAdapter da = new SqlDataAdapter(cmdText, con);
DataSet ds = new DataSet();
try
{
con.Open();
da.Fill(ds, "DataTable");
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
finally
{
con.Close();
}
return ds;
}
上面的连接不对,是这个:http://www.zhouqiming.com/asp/baidu3%E4%BB%A3%E7%A0%81.htm 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询