Monday, March 26, 2012

The ConnectionString property has not been initialized

hi

i'm using the register.aspx just to enter data, and i'm not using the code for cookies so my code when preesing register button (note i'm using instead of customer , auther)

Sub Button1_Click(sender As Object, e As EventArgs)

' Only attempt a login if all form fields on the page are valid

If Page.IsValid = True Then

' Add New Customer to CustomerDB database
Dim accountSystem As ASPNET.StarterKit.Commerce.AutherregisterDB = New ASPNET.StarterKit.Commerce.AutherregisterDB()

Dim Autherid_table as String = accountSystem.AddAuther(Name.Text, Email.Text, Password.Text)

End If

End Sub
and i'm using same classess and declare connection string in webconfig localhost

but i'm getting the error message after filling the register form textboxes

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 15: Line 16:Line 17: Dim Autherid_table as String = accountSystem.AddAuther(Name.Text, Email.Text, Password.Text)Line 18: Line 19:

Source File:E:\AbdCommerce\Autherregfrm.aspx Line:17
Stack Trace:
[InvalidOperationException: The ConnectionString property has not been initialized.] System.Data.SqlClient.SqlConnection.Open() +432 ASPNET.StarterKit.Commerce.AutherregisterDB.AddAuther(String fullName, String email, String password) +380 ASP.Autherregfrm_aspx.Button1_Click(Object sender, EventArgs e) in E:\AbdCommerce\Autherregfrm.aspx:17 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +83 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33 System.Web.UI.Page.ProcessRequestMain() +1277
is there any idea for the cause??

thanks

When you use web config to store setting strings, you need to import namespace System.Configuration. Why did you see the error on the codeDim Autherid_table as String = accountSystem.AddAuther(Name.Text, Email.Text, Password.Text)?Because the code call a classs that does function to add auther. So, try to go to the class file to add System.Configuration namespace.

0 comments:

Post a Comment