N
Nisha
Hi,
I want to store my SQL connection string in an App.Config file. So I did the
following:
On my form I put in a SQLConnection Object called SqlConnection1.
In the properties of SqlConnection1.. under Dynamic Properties--> Advanced
I checked the connection property which by default gets mapped to
sqlconnection1.connectionstring.
In my app.config file the key is automatically added i.e
"sqlconnection1.connectionstring" & the value is my connectionstring.
In the load event of my form I have put in the following lines of code, so I
can retrieve the value of the connectionstring.
Dim ConfigReader As System.Configuration.AppSettingsReader = New
System.Configuration.AppSettingsReader
Dim connectstr As String
connectstr = CType(ConfigReader.GetValue("sqlConnection.ConnectionString",
GetType(System.String)), String)
I expect to see connectstr containing the value of my connectionstring.
However it is always "".
Can someone tell me what I am doing wrong here?
Thanks in advance.
...Nisha
I want to store my SQL connection string in an App.Config file. So I did the
following:
On my form I put in a SQLConnection Object called SqlConnection1.
In the properties of SqlConnection1.. under Dynamic Properties--> Advanced
I checked the connection property which by default gets mapped to
sqlconnection1.connectionstring.
In my app.config file the key is automatically added i.e
"sqlconnection1.connectionstring" & the value is my connectionstring.
In the load event of my form I have put in the following lines of code, so I
can retrieve the value of the connectionstring.
Dim ConfigReader As System.Configuration.AppSettingsReader = New
System.Configuration.AppSettingsReader
Dim connectstr As String
connectstr = CType(ConfigReader.GetValue("sqlConnection.ConnectionString",
GetType(System.String)), String)
I expect to see connectstr containing the value of my connectionstring.
However it is always "".
Can someone tell me what I am doing wrong here?
Thanks in advance.
...Nisha