473,659 Members | 2,640 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to change database when deploying application

I've set my database connection as an Application.Set ting using the
designer.

Since Application.Set tings are read only, how do I change the connection
properties when deploying to another machine ?

Thanks
Harry

Mar 21 '07 #1
7 2508
Perhaps you should put it as User Setting and then build a small form to
allow users to change db settings.
"harry" <no@spam.thanks wrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
I've set my database connection as an Application.Set ting using the
designer.

Since Application.Set tings are read only, how do I change the connection
properties when deploying to another machine ?

Thanks
Harry

Mar 21 '07 #2
VJ
You could also keep it a local xml file or something and read it..

VJ

"harry" <no@spam.thanks wrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
I've set my database connection as an Application.Set ting using the
designer.

Since Application.Set tings are read only, how do I change the connection
properties when deploying to another machine ?

Thanks
Harry

Mar 21 '07 #3

I know what the end users database is called and would prefer to avoid
additional work for user.

I would prefer to set dynamically when loading application.

I guess this is a common scenario and also guess one uses an XML file
deployed with the app.

Having used the designer to set the Connection string, and then built my
DataSet (again using designer) around that connection string I wonder why
the settings are ReadOnly when it's an obvious scenario for many developers.
I guess there's an obvious solution - one that I have yet to find.

Any other suggestions please ?
"Penelope Dramas" <penelopeDOTdra masATpro-transportDOTcom wrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
Perhaps you should put it as User Setting and then build a small form to
allow users to change db settings.
"harry" <no@spam.thanks wrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
>I've set my database connection as an Application.Set ting using the
designer.

Since Application.Set tings are read only, how do I change the connection
properties when deploying to another machine ?

Thanks
Harry


Mar 21 '07 #4

Sure a local XML file would be fine.

I guess I need to change the DataSet.DataSou rce as the program loads, but
not sure how at the moment.

Having already used the designer to create the connection and DataSet, how
do I go about doing this?

Would you know of a URL showing how do do this?

This must be a common scenario.
"VJ" <no***********@ yahoo.comwrote in message
news:ev******** ******@TK2MSFTN GP04.phx.gbl...
You could also keep it a local xml file or something and read it..

VJ

"harry" <no@spam.thanks wrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
>I've set my database connection as an Application.Set ting using the
designer.

Since Application.Set tings are read only, how do I change the connection
properties when deploying to another machine ?

Thanks
Harry


Mar 22 '07 #5
"harry" <no@spam.thanks wrote in news:#oexeMAbHH A.1388
@TK2MSFTNGP05.p hx.gbl:
Since Application.Set tings are read only, how do I change the connection
properties when deploying to another machine ?
I wish VS.NET had a way to inject deployment App.config keys... that would
solve this problem right? :-)
Mar 22 '07 #6
Hi Harry,

data in the app.config isn't readonly at all! It can be accessed through the
configurationma nager-class (but not by my.settings, that's right). Below you
find code I use to set the connection-string at runtime. Be aware of the
fact, that you can use more than one connectionstrin g in your config, hence
the SectName.

Public Shared Sub SetConnectStrin g(ByVal SectName As String, ByVal
ConnectString As String, ByVal encrypt As Boolean)
Dim settings As New ConnectionStrin gSettings
settings.Name = SectName
settings.Connec tionString = ConnectString

Dim config As Configuration
config =
ConfigurationMa nager.OpenExeCo nfiguration(Con figurationUserL evel.None)
config.Connecti onStrings.Conne ctionStrings.Re move(SectName)
config.Connecti onStrings.Conne ctionStrings.Ad d(settings)
If encrypt Then

config.Connecti onStrings.Secti onInformation.P rotectSection(N othing)
End If
config.Save()
End Sub
HTH

Volker

"harry" wrote:
I've set my database connection as an Application.Set ting using the
designer.

Since Application.Set tings are read only, how do I change the connection
properties when deploying to another machine ?

Thanks
Harry

Mar 22 '07 #7

Great.

Thanks for your help and saving me a heap of time.

Regards
Harry
"VolkerS" <Vo*****@discus sions.microsoft .comwrote in message
news:B3******** *************** ***********@mic rosoft.com...
Hi Harry,

data in the app.config isn't readonly at all! It can be accessed through
the
configurationma nager-class (but not by my.settings, that's right). Below
you
find code I use to set the connection-string at runtime. Be aware of the
fact, that you can use more than one connectionstrin g in your config,
hence
the SectName.

Public Shared Sub SetConnectStrin g(ByVal SectName As String, ByVal
ConnectString As String, ByVal encrypt As Boolean)
Dim settings As New ConnectionStrin gSettings
settings.Name = SectName
settings.Connec tionString = ConnectString

Dim config As Configuration
config =
ConfigurationMa nager.OpenExeCo nfiguration(Con figurationUserL evel.None)
config.Connecti onStrings.Conne ctionStrings.Re move(SectName)
config.Connecti onStrings.Conne ctionStrings.Ad d(settings)
If encrypt Then

config.Connecti onStrings.Secti onInformation.P rotectSection(N othing)
End If
config.Save()
End Sub
HTH

Volker

"harry" wrote:
>I've set my database connection as an Application.Set ting using the
designer.

Since Application.Set tings are read only, how do I change the connection
properties when deploying to another machine ?

Thanks
Harry


Mar 22 '07 #8

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

Similar topics

3
2302
by: pcPirate | last post by:
Hi, I'm currently writing an application using C#. However, to access and update a database, I must only use rdo (due to a certain reason). I heard I can use the VB6 to make the function of accessing and updating the database and then, compile it into dll. After that, using the C#, adding the reference of the dll, I would be able to access or update the database. Q1) Is this true? Q2) If so, how do I do that? Can anybody share some...
1
2519
by: K Meyer | last post by:
Everything in the deployment works fine with the exception of the address of the database also deployed on the remote server. The string address is found under "oledbconnection" in the ".... .aspx.jsl" file. What should the string address look like on the remote computer? On my development machine the address is:
2
1152
by: Bennett Haselton | last post by:
When you create a C# Web Application project, you have to specify at project creation time the URL you want to publish the project to. Is there any way in the IDE to change the server that the project is published to at build time? You can go into Project properties -> Common Properties -> Web Settings and under "Web Server Information" it shows the name of the Web server -- but it's greyed out so that you can't edit it. Is that...
5
1806
by: sling blade | last post by:
I have developled my first major app and i am trying to deploy it in to a host server for publication. However the app tries to use the physical path used during development. Is the path hard coded in my dll or similar file? In trying to nail down exactly where this path is located, I have deleted all files except for the index files, the Global.asax files,
3
11008
by: route_coder | last post by:
I am using access database to create a crystal report in VB.NET Everything works fine when I run on my machine. But when I am deploying it other windows machines. It is asking for database server name and logon information. The problem which I understood from this is that the path is hardcoded in the crystal report and the database is in my bin folder. when I run my app on other machines it is looking for the database in that folder and...
3
1497
by: Ben | last post by:
Hi all I have made a vb.net windows app that works great in design. But after deploying the app on the same design computer (my own) the app can not find any of the two databases it needs to operate. I have tried setting their connection strings to application.startupath, but with no luck. My question is, what is the correct way to code a connection string so that it will be seen by the app on any computer when deployed, especially when one of...
4
2613
by: Collin Peters | last post by:
I have searched the Internet... but haven't found much relating to this. I am wondering on what the best practices are for migrating a developmemnt database to a release database. Here is the simplest example of my situation (real world would be more complex). Say you have two versions of your application. A release version and a development version. After a month of developing you are ready to release a new version. There have...
3
2611
by: pooba53 | last post by:
I have a VB .NET 2003 application that communicates with an Access db. I am deploying the application using the Wizard that creates an install package and it IS properly grabbing the Access db and putting it in the Program Files directory along with the application executable, no problem. The problem is this... The OleDbConnection knows of the database in an absolute location (i.e. C:\Documents and Settings\ApplicationDB\data.mdb
2
1764
by: Gilbert Tordeur | last post by:
Hello, It is about a VB2008 intranet application. It uses a SQL Server database. The ConnectionString is defined in the connectionStrings section of the web.config file. This application uses ObjectDataSource objects, defined in design mode. I would like to use a different database depending on the execution environment (development or production).
0
8428
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
8339
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,...
1
8535
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
8629
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
6181
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
5650
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
4338
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2757
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 we have to send another system
2
1982
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.