473,785 Members | 2,283 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.confi g
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 2020
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.confi g
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.Conne ctionString =
CType(configura tionAppSettings .GetValue("DBCo nn.ConnectionSt ring",
GetType(System. String)), String)
-----------------------------------------------
Here is what is in the config file:

<?xml version="1.0" encoding="Windo ws-1252"?>
<configuratio n>
<appSettings>
<!-- User application and configured property settings go
here.-->
<!-- Example: <add key="settingNam e" value="settingV alue"/> -->
<add key="DBConn.Dat aSource" value="C:\Progr am
Files\AutoMind\ AutoMind\AutoMi nd.mde" />
<!--StartFragment -->
<add key="DBConn.Con nectionString" 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\AutoMi nd.mde&quot;;Je t OLEDB:Engine
Type=5;Provider =&quot;Microsof t.Jet.OLEDB.4.0 &quot;;Jet OLEDB:System
database=;Jet OLEDB:SFP=False ;persist security info=False;Exte nded
Properties=;Mod e=Share Deny None;Jet OLEDB:Encrypt Database=False; Jet
OLEDB:Create System Database=False; Jet OLEDB:Don't Copy Locale on
Compact=False;J et OLEDB:Compact Without Replica Repair=False;Us er
ID=Admin;Jet OLEDB:Global Bulk Transactions=1" />
</appSettings>
</configuration>

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


Rakesh Rajan <Ra*********@di scussions.micro soft.com> wrote in message news:<44******* *************** ************@mi crosoft.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.confi g
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
1409
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 database. I could use only the database but is it something good compare to configuration file?
3
2882
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 applications and web services without having to use the machine.config file. I know that I could use the code below to do this but the problem then becomes that when using a shared assembly both the assembly and the config file need to be put...
2
259
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 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
2
9814
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 done the following code, but i dont if its the correct method (doesnt take any form of security into account): Configuration config = ConfigurationManager.OpenExeConfiguration(path);
7
6149
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 encryption. I have encrypted the connectionsettings block in the config file but obviously when I come to deploy the solution to other PC's, it cannot read the block as it doesn't have the keys to decrypt. I understand that as far as ASP.NET...
9
2288
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 of view, ini-files are more comfortable to read and edit) Where should I store user specific config data? Where should I store machine specific config data?
7
10323
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 called AssemblySettings that someone (I forget his name) had written. When the class library was finished, you deployed it to the GAC and put the configuration files in the GAC with the class library assembly. This no longer works. In fact...
0
818
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" my web application configration file is available in "c:\inetpub\wwwroot\sampleApplication\web.config" when i access my web site it refers the share point configration file and throws this error message like this "The XML file web.config could...
3
4428
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 the other machine I get the error upon instantiating the service client. I add the reference by choosing Add Service Reference from the project menu, and pointing to the remote wsdl file. I can't seem to find what the difference between the two...
0
9646
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9483
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10157
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10096
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9956
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7504
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6742
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5386
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5514
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.