帮忙~~在线等~关于错误报告的~

comtry 2003-12-24 04:33:14
新做了个程序,在本地运行的很好,上传却出现了错误。错误代码如下:
Server Error in '/' Application.
--------------------------------------------------------------------------------

The ConnectionString property has not been initialized.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: The ConnectionString property has not been initialized.

Source Error:


Line 91: conn = New sqlConnection(ConfigurationSettings.AppSettings("Êý¾Ý¿â"))
Line 92: comd = New sqlCommand(sql, conn)
Line 93: comd.Connection.Open()
Line 94: dr = comd.ExecuteReader
Line 95: If dr.Read Then AllRecord = dr(0)


Source File: d:\users\comtry\default.aspx Line: 93

Stack Trace:


[InvalidOperationException: The ConnectionString property has not been initialized.]
System.Data.SqlClient.SqlConnection.Open() +433
ASP.default_aspx.__Render__control1(HtmlTextWriter __output, Control parameterContainer) in d:\users\comtry\default.aspx:93
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +27
System.Web.UI.Control.Render(HtmlTextWriter writer) +7
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +241
System.Web.UI.Page.ProcessRequestMain() +1912

谢谢~~
...全文
110 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
comtry 2003-12-24
  • 打赏
  • 举报
回复
事情是:在其他页面是可以用的!我感觉也是数据库连接问题,但…………
jaffler 2003-12-24
  • 打赏
  • 举报
回复
The ConnectionString property has not been initialized.]
System.Data.SqlClient.SqlConnection.Open() +433 错误的地方
感觉还是连接有问题,例如:server=localhost;database=linpcontract;uid=sa;pwd= 全部写对了?呵呵
奇怪了....
comtry 2003-12-24
  • 打赏
  • 举报
回复
回 sjc0(流浪者)
conn.open();没用的,我试过~
调用也是没有问题的吧~~你看上面的代码~~
sjc0 2003-12-24
  • 打赏
  • 举报
回复
conn.open();
sjc0 2003-12-24
  • 打赏
  • 举报
回复
例如Web.Config中
<appSettings>
<add key="sqlconnstring" value="server=localhost;database=linpcontract;uid=sa;pwd=;" />
</appSettings>
调用
conn = New sqlConnection(ConfigurationSettings.AppSettings("sqlconnstring"))
comtry 2003-12-24
  • 打赏
  • 举报
回复
昏~那是编码问题,就显示成这样子了~不是它的错~~~请帮忙看看别的地方有什么错~?我想是不是…………我也不知道,因为本地运行的很好,其他页面也行~
我想是数据库连接的事???~~其他页面都是绑定的DataGrid,运行没问题的。这些有问题的页面都是用的dataset.但是我不知道错误在哪儿啊~~贴点代码:
Dim conn As sqlConnection, da As sqlDataAdapter, ds As DataSet, sql As String
Dim comd As sqlCommand, dr As sqlDataReader
sql = "Select Count(*) From car"
conn = New sqlConnection(ConfigurationSettings.AppSettings("数据库"))
comd = New sqlCommand(sql, conn)
comd.Connection.Open()
dr = comd.ExecuteReader
If dr.Read Then AllRecord = dr(0)
dr.Close()
comd.Connection.Close()
comd.Dispose()
zhaozhongju 2003-12-24
  • 打赏
  • 举报
回复
("Êý¾Ý¿â"))

这是什么东东
comtry 2003-12-24
  • 打赏
  • 举报
回复
应该不是它的错~那是编码问题,显示成那样子了。其他页面没事的,我还绑定DropDownList了,显然应该不是AppSettings[]的错。
xpzhl 2003-12-24
  • 打赏
  • 举报
回复
你这显然是数据连接字符串有问题,你的AppSettings[]中一堆什么
comtry 2003-12-24
  • 打赏
  • 举报
回复
自己顶下 请大家帮帮忙~~很多方法都试了,哎~~郁闷~~

62,072

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧