Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to modify connection string at runtime
Message
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Versions des environnements
Environment:
C# 2.0
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01212660
Message ID:
01212669
Vues:
10
>I've been using VS2005 and its designers to set up a DataGridView. The DataGridView is being filled by a TableAdapter. The TableAdapter uses a connection object whose connection string is set from
>
>global::GetDatabaseIDsDlg.Properties.Settings.Default.ConnectionStringWoundDB;
>
>This was all set up by the VS2005 designer. This works fine for developing the application. However, I want to be able to change the connection string at runtime. But, I have found that the designer creates Properties.Settings.Default.ConnectionStringWoundDB as ReadOnly. So, I can't change that at runtime.
>
>Surely, there must be some simple way to change the ConnectionString that my TableAdapters are using at runtime. But I haven't been able to figure it out yet. (Still new at .NET development)
>
>Kind of a corrollary: The designers are just implementing in code what I set up on properties pages, etc. But, I can't see where ConnectionStringWoundDB is made read-only.
>
>Thanks for the help.
>
>Jim

When you create the connection string from the designer you can save it to the application's configuration file app.config. To change the connection string then all you have to do is modify it in the configuration file.
Michael McLain
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform