新手上路,恳请帮忙!ConnectionString 属性尚未初始化
从另外一个项目转移的代码,只是修改了数据库名及表名,出现错误:
“/text”应用程序中的服务器错误。
--------------------------------------------
ConnectionString 属性尚未初始化。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.InvalidOperationException: ConnectionString 属性尚未初始化。
代码如下:
Imports System.Data.SqlClient
Imports Microsoft.Web.UI.WebControls
Public Class bumen
Inherits System.Web.UI.Page
#Region " Web 窗体设计器生成的代码 "
'该调用是 Web 窗体设计器所必需的。
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents TreeView1 As Microsoft.Web.UI.WebControls.TreeView
Protected WithEvents FONT1 As System.Web.UI.HtmlControls.HtmlGenericControl
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox
Protected WithEvents Label2 As System.Web.UI.WebControls.Label
Protected WithEvents TextBox2 As System.Web.UI.WebControls.TextBox
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
Protected WithEvents Button2 As System.Web.UI.WebControls.Button
'注意: 以下占位符声明是 Web 窗体设计器所必需的。
'不要删除或移动它。
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: 此方法调用是 Web 窗体设计器所必需的
'不要使用代码编辑器修改它。
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'在此处放置初始化页的用户代码
If Not IsPostBack Then
Dim conn As New SqlConnection
Dim cmd As New SqlCommand
' TreeView1.Attributes.Add( "onclick ", "tree_onclick() ; ")
&