Click here to Skip to main content
16,020,188 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello i'm using visual studio 2008, vb.net and oracle as my db.

this is what i save in my apps.config

<appSettings/>
<add key="SMSDW_connection" value="server=abc;database=efg;User ID=**;Password=**;"/>

and this is my code for calling the apps.config file :

Dim connectionString = System.Configuration.ConfigurationManager.AppSettings("SMSDW_connection")
Dim sqlConnection As OracleClient.OracleConnection = New OracleClient.OracleConnection(connectionString)

but i still got an error which is :

The ConnectionString property has not been initialized.

i have add reference : System.Configuration and Imports System.Configuration
Posted

1 solution

VB
Dim connectionString = Properties.Settings.Default.SMSDW_connection


Sorry, it uses My.Settings (too used to C#). For example:

VB
Dim connectionString = My.Settings.SMSDW_connection


See Accessing Application Settings in VB.NET[^]
 
Share this answer
 
v2
Comments
gogole_yuna 11-Jun-13 23:09pm    
tq but still not working. i have to declare the properties
Ron Beyer 12-Jun-13 0:04am    
I updated the answer, I apologize, I was thinking too much in C#.
gogole_yuna 12-Jun-13 0:24am    
ok tq

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900