编程中国 | 业界新闻 | 技术文章 | 视频教程 | 下载频道 | 程序源码 | 个人空间 | 编程论坛  
全能 ASP / PHP / ASP.NET 主机,支持月付专业 MSSQL 数据库空间,支持月付专业 MySQL 数据库空间,支持月付学习型 ASP/PHP/ASP.NET 主机 30元/年
发新话题
打印

帮忙改个代码!!!

帮忙改个代码!!!

命名空间“System.Configuration”中不存在类型或命名空间名称“ConfigurationManager”(是缺少程序集引用吗?)
怎么解决
在vs2005中这段代码怎么改写
SqlConnection myconnection = new SqlConnection("Server=(Local);database=test;uid=sa;pwd=sa");
myconnection.ConnectionString =
System.Configuration.ConfigurationManager.ConnectionStrings["AttDownConnectionString"].ConnectionString;
SqlCommand cmd1 = new SqlCommand();
cmd1.CommandText = "select count(QuestionId) from tblQuestion where QuestionId=4";
cmd1.Connection = myconnection;
myconnection.Open();
int count = (int)cmd1.ExecuteScalar();
myconnection.Close();
lable2.Text = (cmd1.ExecuteScalar()).ToString();

[ 本帖最后由 ljl8853 于 2008-6-19 14:46 编辑 ]

[ 本帖最后由 ljl8853 于 2008-6-19 14:52 编辑 ]

TOP

你是用的2005吧  呵呵 这个字符串是2003版本里面的了  在2005中是
System.Configuration.ConfigurationSettings.AppSettings[""]写的

TOP

发新话题