473,480 Members | 1,726 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Persistent settings

Hi

I need to store the path to db in my app. I have used app setting for this.
Unfortunately various clients have different db paths and I have set them up
once on each client location. The problem is that when I send them updates
and they uninstall the old version and reinstall the new version the setting
is reset to my settings. This is because the old configuration file is
deleted and replaced by the new one included in the app. Is there a way to
have a setting that is not overwritten by an application reinstall?

Thanks

Regards


Apr 28 '07 #1
4 1770
On Apr 28, 9:12 am, "John" <J...@nospam.infovis.co.ukwrote:
Hi

I need to store the path to db in my app. I have used app setting for this.
Unfortunately various clients have different db paths and I have set them up
once on each client location. The problem is that when I send them updates
and they uninstall the old version and reinstall the new version the setting
is reset to my settings. This is because the old configuration file is
deleted and replaced by the new one included in the app. Is there a way to
have a setting that is not overwritten by an application reinstall?

Thanks

Regards
I have always used a separate file for things like this - perhaps you
could use an Xml file that is stored in the application's base
directory. If you are worried about the sensitive nature of connection
strings, you could even have your app encrypt/decrypt that file.

Thanks,

Seth Rowe

Apr 28 '07 #2
Many thanks for that. Would be grateful for a link on how to handle xml
files.

Thanks

Regards
"rowe_newsgroups" <ro********@yahoo.comwrote in message
news:11**********************@e65g2000hsc.googlegr oups.com...
On Apr 28, 9:12 am, "John" <J...@nospam.infovis.co.ukwrote:
>Hi

I need to store the path to db in my app. I have used app setting for
this.
Unfortunately various clients have different db paths and I have set them
up
once on each client location. The problem is that when I send them
updates
and they uninstall the old version and reinstall the new version the
setting
is reset to my settings. This is because the old configuration file is
deleted and replaced by the new one included in the app. Is there a way
to
have a setting that is not overwritten by an application reinstall?

Thanks

Regards

I have always used a separate file for things like this - perhaps you
could use an Xml file that is stored in the application's base
directory. If you are worried about the sensitive nature of connection
strings, you could even have your app encrypt/decrypt that file.

Thanks,

Seth Rowe

Apr 28 '07 #3
"John" <Jo**@nospam.infovis.co.ukschrieb:
I need to store the path to db in my app. I have used app setting for
this. Unfortunately various clients have different db paths and I have set
them up once on each client location. The problem is that when I send them
updates and they uninstall the old version and reinstall the new version
the setting is reset to my settings. This is because the old configuration
file is deleted and replaced by the new one included in the app. Is there
a way to have a setting that is not overwritten by an application
reinstall?
Take a look at 'My.Settings' and the "Settings" tab in "My Project" if you
are using VS 2005.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Apr 28 '07 #4
On Apr 28, 12:25 pm, "John" <J...@nospam.infovis.co.ukwrote:
Many thanks for that. Would be grateful for a link on how to handle xml
files.

Thanks

Regards

"rowe_newsgroups" <rowe_em...@yahoo.comwrote in message

news:11**********************@e65g2000hsc.googlegr oups.com...
On Apr 28, 9:12 am, "John" <J...@nospam.infovis.co.ukwrote:
Hi
I need to store the path to db in my app. I have used app setting for
this.
Unfortunately various clients have different db paths and I have set them
up
once on each client location. The problem is that when I send them
updates
and they uninstall the old version and reinstall the new version the
setting
is reset to my settings. This is because the old configuration file is
deleted and replaced by the new one included in the app. Is there a way
to
have a setting that is not overwritten by an application reinstall?
Thanks
Regards
I have always used a separate file for things like this - perhaps you
could use an Xml file that is stored in the application's base
directory. If you are worried about the sensitive nature of connection
strings, you could even have your app encrypt/decrypt that file.
Thanks,
Seth Rowe
Here's a quick console application that briefly demonstrates how to
use an Xml file:

Imports System.Xml

Module Module1

Sub Main()
Console.WriteLine("Saving Settings...")
SaveSettings()
System.Threading.Thread.Sleep(500)
Console.WriteLine(GetSetting("ConnectionString"))
Console.Read()
Dim fileName As String = String.Format("C:\Document and
Settings\{0}\Desktop\MyXmlFile.Xml", Environment.UserName)
If System.IO.File.Exists(fileName) Then
System.IO.File.Delete(fileName)
End If
End Sub

Public Sub SaveSettings()
Dim writer As XmlWriter = XmlWriter.Create(String.Format("C:
\Documents and Settings\{0}\Desktop\MyXmlFile.Xml",
Environment.UserName))
writer.WriteStartElement("Settings")
writer.WriteStartElement("ConnectionString")
writer.WriteString("YourConnString")
writer.WriteEndElement() ' ConnectionString
writer.WriteEndElement() ' Settings
writer.Close()
End Sub

Public Function GetSetting(ByVal nodeName As String) As String
Dim doc As New XmlDocument
doc.Load(String.Format("C:\Documents and Settings\{0}\Desktop
\MyXmlFile.Xml", Environment.UserName))
Dim node As XmlNode = doc.GetElementsByTagName(nodeName)(0)
Return node.InnerText
End Function

End Module

Thanks,

Seth Rowe

Apr 29 '07 #5

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

Similar topics

16
3283
by: Paul Rubin | last post by:
I've had this recurring half-baked desire for long enough that I thought I'd post about it, even though I don't have any concrete proposals and the whole idea is fraught with hazards. Basically...
0
2474
by: obhayes | last post by:
Hi All, Im using classic ASP (3.0) and I have a web farm with 2 webservers (webserver A and webserver B, both windows server 2003). I do not want to store any client specific information on the...
1
4594
by: brad | last post by:
Hi, Im using classic ASP (3.0) and I have a web farm with 2 webservers (webserver A and webserver B, both windows server 2003). I do not want to store any client specific information on the...
5
4990
by: Steve - DND | last post by:
How can I exceed the number of persistent connections allowed on a ServicePoint(which is 2 connections)? I believe this is the cause of the problems with my thread from earlier titled "Unable to...
8
4484
by: Steve | last post by:
Can anyone tell me the preferred method for writing and retrieving persistent information using .Net. Specifically, I am referring to information that you used to see in registry keys or .ini...
2
1942
by: NWx | last post by:
Hi, Is Cache appropriate to store persistent variables used across the application? What I want is to store UserID for currently logged user, SessionID (my own SessionID, which keep track of...
3
4281
by: sanchita | last post by:
Hello everyone, I didn't get any response in "Security" forum hence posting here again. I am having problem with persistent cookies. Even after setting "CreatePersistentCookie" to true in...
1
2150
by: hussain123 | last post by:
Hi, We have an issue wherein we have an persistent store and are caching the url's visited.Now the problem is when the first url is cached then any subsequent request even though to some other url...
0
1451
by: Alex N | last post by:
My question relates to one of the previous ones, http://bytes.com/topic/c-sharp/answers/545389-saving-properties-settings-dll-project If i want to share a single <app>.exe.config file among...
0
6905
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...
0
7080
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...
1
6736
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
6908
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
5331
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,...
1
4772
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...
0
2994
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...
0
2980
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1299
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.