Jump to content

Cre8asiteforums Internet Marketing
and Conversion Web Design


Problem With Sql Connectionstring Property Cannot Be Initialized

  • Please log in to reply
No replies to this topic

#1 hm9


    Mach 1 Member

  • 250 Posts Club
  • 354 posts

Posted 15 November 2011 - 12:20 PM

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

RSS Feed

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users