Member Avatar for Rahul47

Hello guys,

I am using connected architecture to develop an application.
For every form am designing there requires to put the connection string to connect to databse. Is there any way that If I change connection string at one point it is automatically changed at other.

Thanks

Declare the string in the application settings, then call that setting.

Example:

'In Application Settings

Name | Type |   Scope   | Value
myCon|String|Application|'Your Connection String Here

'In code
Dim con As New OleDBConnection(My.Settings.myCon)

If the string is changed in the application settings - it is changed globally.

Member Avatar for Rahul47

@Begginnerdev: What if i use Type as Connection String ?
IN that Case it aint working !

Any Suggestions ??

Is this ConnectionString a Type, or are you refering the the SQLClient.ConnectionString property?

Member Avatar for Rahul47

@Begginnerdev: ConnectionString is a type in settings of project.

I am assuming you are using a project data source?

Is this correct?

If so, what error/message are you getting when you change the connection string?

If not, where is the ConnectionString type coming from?

Is it a custom class/type/structure?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.