473,407 Members | 2,359 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

How do I get configuration file to point to the correct DB file?

The program I have written with VB/NET 2003 has a Myapp.exe.config
file that I did not know I would be creating. My program using an
Access db and can not find the DB file after building the executable.
When this config file is there it runs ok and when it is not there it
can not find the DB file. When I put the program on another computer
it can not find the DB file either way. Does anyone have an idea what
is happening?

Thanks,
Al
Jul 21 '05 #1
2 1986
Hi Repasky,

In your scenario, it's best to save the path to your access db into a config file.
Use the app.config file to create a new section and a key which would point to the DB file. So, when you move your app to a new computer, just change the config file to edit the key value to point to the new file location.

Try this MSDN link for more info:
http://msdn.microsoft.com/library/de...onsections.asp

--
Rakesh Rajan
"Al Repasky" wrote:
The program I have written with VB/NET 2003 has a Myapp.exe.config
file that I did not know I would be creating. My program using an
Access db and can not find the DB file after building the executable.
When this config file is there it runs ok and when it is not there it
can not find the DB file. When I put the program on another computer
it can not find the DB file either way. Does anyone have an idea what
is happening?

Thanks,
Al

Jul 21 '05 #2
Here is what I tried and it does not work. I did not do it exactly as
you told me, but I did get the filename in the config file. I also
put in a display of the file string that it is using and it is
pointing to the correct place. It work on my development computer,
but not on the other computer. Maybe it is too old to run .NET on.
It is a Pentium 120. I did add a line manually and forgot to take it
out of the config fine. It is the add key to DataSource. I do not
think that would matter to have the extra line.

Does anyone have any more ideas how to make this work?

Thanks,
Al
-------------------------------
Here is the code it now have:

'
'DBConn
'
Me.DBConn.ConnectionString =
CType(configurationAppSettings.GetValue("DBConn.Co nnectionString",
GetType(System.String)), String)
-----------------------------------------------
Here is what is in the config file:

<?xml version="1.0" encoding="Windows-1252"?>
<configuration>
<appSettings>
<!-- User application and configured property settings go
here.-->
<!-- Example: <add key="settingName" value="settingValue"/> -->
<add key="DBConn.DataSource" value="C:\Program
Files\AutoMind\AutoMind\AutoMind.mde" />
<!--StartFragment -->
<add key="DBConn.ConnectionString" value="Jet OLEDB:Global Partial
Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database Locking
Mode=1;Data Source=&quot;C:\Program
Files\AutoMind\AutoMind\AutoMind.mde&quot;;Jet OLEDB:Engine
Type=5;Provider=&quot;Microsoft.Jet.OLEDB.4.0&quot ;;Jet OLEDB:System
database=;Jet OLEDB:SFP=False;persist security info=False;Extended
Properties=;Mode=Share Deny None;Jet OLEDB:Encrypt Database=False;Jet
OLEDB:Create System Database=False;Jet OLEDB:Don't Copy Locale on
Compact=False;Jet OLEDB:Compact Without Replica Repair=False;User
ID=Admin;Jet OLEDB:Global Bulk Transactions=1" />
</appSettings>
</configuration>

-----------------------------------------------------------------------------------


Rakesh Rajan <Ra*********@discussions.microsoft.com> wrote in message news:<44**********************************@microso ft.com>...
Hi Repasky,

In your scenario, it's best to save the path to your access db into a config file.
Use the app.config file to create a new section and a key which would point to the DB file. So, when you move your app to a new computer, just change the config file to edit the key value to point to the new file location.

Try this MSDN link for more info:
http://msdn.microsoft.com/library/de...onsections.asp

--
Rakesh Rajan
"Al Repasky" wrote:
The program I have written with VB/NET 2003 has a Myapp.exe.config
file that I did not know I would be creating. My program using an
Access db and can not find the DB file after building the executable.
When this config file is there it runs ok and when it is not there it
can not find the DB file. When I put the program on another computer
it can not find the DB file either way. Does anyone have an idea what
is happening?

Thanks,
Al

Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: serge calderara | last post by:
Dear all, I have a windows application linked to a database. I was wondering about one point. Do I have to go for a configuration file anyway or can I store all my application in this...
3
by: Florida Coder | last post by:
I have the need to store some application specific configuration data to be used by a class library and or a windows service. I would like to do this in a fashion similar to the way we do with...
2
by: Al Repasky | last post by:
The program I have written with VB/NET 2003 has a Myapp.exe.config file that I did not know I would be creating. My program using an Access db and can not find the DB file after building the...
2
by: Mark Ingram | last post by:
Hi, whats the correct way of opening up a different applications configuration file? i.e. i want to open someotherapp.exe.config and read the settings contained in "applicationSettings". Ive...
7
by: Steven Cliff | last post by:
I have started to use the new Enterprise Library (Jan 06) and have set up a skeleton project using the DAAB. This all seems to work fine apart from when I come to secure the app.config file via...
9
by: KarlM | last post by:
After reading some articles regarding confuguration data I'm a bit confused. Where is the right place for storing configuration data? - XML-files? - registry? - INI-files? (from a users point...
7
by: Peter Bradley | last post by:
OK. A bit behind the times, I know; but we're just moving over to .NET 2.0. How on earth do you manage configuration settings in a class library in .NET 2.0? In version 1.1, we used a handy class...
0
by: joerozario | last post by:
Dear freinds, i have an web application with a configuration file. and i have share point installed in my system. share point configuration file is available in "c:\inetpub\wwwroot\web.config"...
3
by: Lance Wynn | last post by:
Hello, I am receiving this error when trying to instantiate a webservice component. I have 2 development machines, both are XP sp2 with VS 2008 installed. On one machine, the code works fine. On...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.