Where to store connection info

R

Rob

The app.config in VB 2005 appears to be riddled with bugs....

From solution explorer I right click on the Project | Properties... then I
use the grid to add the app settings... AND they are saved in the
app.config.xml as well, however, the program uses the value that were
originally stored in the settings.

I have run the Build and Saved the file, I even exited and re-opened the
program as well as rebooted the machine.

I have no idea where it is getting the original values from, however, when I
double click on the app.config I get many messages stating that it "Could
not find schema information for this element or that attribute". Could the
xsd be corrupt ? How to fix ?

I am about to give up on using the app.config... is my only other option to
store the connections as Public variables in a startup routine ?
 
M

Mr. Arnold

Rob said:
The app.config in VB 2005 appears to be riddled with bugs....

From solution explorer I right click on the Project | Properties... then I
use the grid to add the app settings... AND they are saved in the
app.config.xml as well, however, the program uses the value that were
originally stored in the settings.

The program is using appname.exe.config is where it's getting its app.config
information.

App.config in the project is just a template and appname.exe.config is built
when the exe is built, which appname.exe.config is built from app.config.

So, if you don't move appname.exe.config to wherever appname.exe is located,
then the appname.exe is going to use the old appname.exe.config with old
settings.
I have run the Build and Saved the file, I even exited and re-opened the
program as well as rebooted the machine.

I have no idea where it is getting the original values from, however, when
I double click on the app.config I get many messages stating that it
"Could not find schema information for this element or that attribute".
Could the xsd be corrupt ? How to fix ?

I am not having that problem when double clicking the app.config in the
project, the file in the project location on the HD or the
appname.exe.config on the HD where the appname.exe is located to open the
file up in the IDE.
I am about to give up on using the app.config... is my only other option
to store the connections as Public variables in a startup routine ?

I am using VB 2005 Express with no problems in this area in using an
app.config file in a VB.NET project.
 
R

Rob

Thank you so much for taking the time to respond... I have worked all day on
this...

So may I edit this file directly ? I think I like the VS 2003 solution
better...

Rob
 
M

Mr. Arnold

Rob said:
Thank you so much for taking the time to respond... I have worked all day
on this...


So may I edit this file directly ? I think I like the VS 2003 solution
better...

You can use the System.ConfigurationManager namespace in .Net Framework 2.0
to manipulate/write/read appname.exe.config or you can do it manually. It
will even get the connection string data with ease.

Lookup ConfigurationManager on Google which should give you examples as to
what you can do with ConfigurationManager.

Regardless of it being 2003 or 2005, what the program is using is
appname.exe.config, and app.config is just a template to build
appname.exe.config.

In 2003 using Framework 1.1 would have needed to download and install the
Application Block. Now, it's part of the 2.0 Framework.


<snipped>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top