Home All Groups Group Topic Archive Search About

Share datasource among programs

Author
31 Jan 2006 10:02 PM
Matthew
I have written many small apps that use one MSSQL database.
Too late, I realized a problem.  The connection is hard coded in each
app.  And it's time to upgrade my server!
To keep this from haunting me in the future, is there a way to specify
a database connection in a central location?

Matthew

Author
1 Feb 2006 9:14 AM
Cor Ligthert [MVP]
Matthew,

You can store it everywhere. Version 2.0 does it now with the designer
generated database parts in the app.config file.

\\\\
<configuration>
    <configSections>
    </configSections>
    <connectionStrings>
        <add
name="WindowsApplication4.My.MySettings.NorthwindConnectionString"
            connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\test1\Northwind.mdb"
            providerName="System.Data.OleDb" />
    </connectionStrings>
etc.
///

I hope this helps,

Cor