Jump to content


Web Site Design, Usability, SEO & Marketing Discussion and Support

Sign in to follow this  

Problem With Sql Connectionstring Property Cannot Be Initialized

Recommended Posts





I am running an asp.net page and trying to connection to a database using a connection string on the web.config file. This generates the following error message:




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




when i embed the connection string on the application, it works ok but when I add the connection string to the web config file it throws the above error message




Below is a copy of the web config file and also the application where I am trying to use it.








----------------------------ASP.NET PAGE-------------------




Dim strInsert As String


Dim cmdInsert As SqlCommand


Dim strConnection As String


Dim sqlConn As SqlConnection




strConnection = ConfigurationSettings.AppSettings("connection")


sqlConn = New SqlConnection (strConnection)




---------------------------Web.Config Page-----------------------








<compilation debug="true"/>






<add name="connection"


connectionString="Server=ip addressused;Database=dbnameused;User Id=usernameused; password=passwordused"


providerName="System.Data.SqlClient" />














I tried using coonectionstrings instead of appsettings tag but it didnt work either






Any ideas






Thanks in advance


  • Like 1

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this