源错误:
行 22: SqlConnection Con = new SqlConnection(ConfigurationManager.AppSettings["ConSql"]);
行 23:
行 24: Con.Open();
行 25: SqlCommand Com = new SqlCommand(cmdtxt, Con);
行 26: SqlDataReader dr = Com.ExecuteReader();堆栈跟踪:
[InvalidOperationException: ConnectionString 属性尚未初始化。]
System.Data.SqlClient.SqlConnection.PermissionDemand() +46
System.Data.SqlClient.SqlConnectionFactory.PermissionDemand(DbConnection outerConnection) +22
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +89
System.Data.SqlClient.SqlConnection.Open() +160
message.Page_Load(Object sender, EventArgs e) in d:\百特\baite\message.aspx.cs:24
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +13
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +45
System.Web.UI.Control.OnLoad(EventArgs e) +80
System.Web.UI.Control.LoadRecursive() +49
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3750
代码:
protected void Page_Load(object sender, EventArgs e)
{
string cmdtxt = "SELECT * FROM tb_LeaveWord"; SqlConnection Con = new SqlConnection(ConfigurationManager.AppSettings["ConSql"]); Con.Open();
SqlCommand Com = new SqlCommand(cmdtxt, Con);
SqlDataReader dr = Com.ExecuteReader();
dr.Read();
if (dr.HasRows)
{
uno = dr["Uno"].ToString();
DateTime = dr["DateTime"].ToString();
Subject = dr["Subject"].ToString();
Content = dr["Content"].ToString();
Reply = dr["Reply"].ToString();
}
dr.Close();
this.dlBind();
}请请请帮忙解决下!
行 22: SqlConnection Con = new SqlConnection(ConfigurationManager.AppSettings["ConSql"]);
行 23:
行 24: Con.Open();
行 25: SqlCommand Com = new SqlCommand(cmdtxt, Con);
行 26: SqlDataReader dr = Com.ExecuteReader();堆栈跟踪:
[InvalidOperationException: ConnectionString 属性尚未初始化。]
System.Data.SqlClient.SqlConnection.PermissionDemand() +46
System.Data.SqlClient.SqlConnectionFactory.PermissionDemand(DbConnection outerConnection) +22
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +89
System.Data.SqlClient.SqlConnection.Open() +160
message.Page_Load(Object sender, EventArgs e) in d:\百特\baite\message.aspx.cs:24
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +13
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +45
System.Web.UI.Control.OnLoad(EventArgs e) +80
System.Web.UI.Control.LoadRecursive() +49
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3750
代码:
protected void Page_Load(object sender, EventArgs e)
{
string cmdtxt = "SELECT * FROM tb_LeaveWord"; SqlConnection Con = new SqlConnection(ConfigurationManager.AppSettings["ConSql"]); Con.Open();
SqlCommand Com = new SqlCommand(cmdtxt, Con);
SqlDataReader dr = Com.ExecuteReader();
dr.Read();
if (dr.HasRows)
{
uno = dr["Uno"].ToString();
DateTime = dr["DateTime"].ToString();
Subject = dr["Subject"].ToString();
Content = dr["Content"].ToString();
Reply = dr["Reply"].ToString();
}
dr.Close();
this.dlBind();
}请请请帮忙解决下!
解决方案 »
- NPOI设置单元格的某些文字加下划线(不是整个单元格)
- URL重定向
- 在线等,问题解决,立马给分,急急急!!前台js事件里怎么调用后台方法?我的代码总是报错,
- 现在学软件需要哪些知识
- error CS0246: 找不到类型或命名空间名称“Sub”
- Hishop.5.2.1正式版发布!(2009年9月5日)
- 急!treeview显示属性问题。谢谢大家!
- 请问如何获得DropListDown控件的已选中项的DataTextField值啊
- 怎么在前台页面向JS里传中文参数?
- DataGrid中一列能否同时帮定数据源的两列?
- 后台获取 select 控件的option的值 =================
- 讨论一个问题:使用asp.net开发一个模仿关于项目管理软件project的web程序
<connectionStrings>
<add name="SqlServices" connectionString="server=.;database=数据库名称;uid=用户名;pwd=密码" providerName="System.Data.SqlClient" />
</connectionStrings>
我照这样改了,还是不行,你看看是不是有哪改还不对?<configuration>
<appSettings>
<add key="ConnectionString" value="server=WWW-901A5024DA8;database=baite;UId=hh;password=hh"/>
<!--定义连接-->
</appSettings>
<connectionStrings>
<add name="SqlServices" connectionString="server=.;database=baite;uid=hh;pwd=hh" providerName="System.Data.SqlClient" />
</connectionStrings>
<appSettings>
<add key="DBConnectionSql" value="server=(local);User ID=sa;Password=sa;database=master;Connection Reset=FALSE"/>
</appSettings>
到51aspx.com上很多实例