Hello,
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)
sqlConn.Open()
---------------------------Web.Config Page-----------------------
<configuration>
<system.web>
<compilation debug=“true”/>
</system.web>
<connectionStrings>
<add name=“connection”
connectionString=“Server=ip addressused;Database=dbnameused;User Id=usernameused; password=passwordused”
providerName=“System.Data.SqlClient” />
</connectionStrings>
</configuration>
I tried using coonectionstrings instead of appsettings tag but it didnt work either
Any ideas
Thanks in advance