Solved

How to change server in connectionstring in vb.Net windows application

Posted on 2010-11-15
2
359 Views
Last Modified: 2012-05-10
I am new in vb.net and created a small windows application. In this app I created 4-5 datasets, and 2-3 connection in code where coded the connectionstring.
Now I want to send this app to client where it would connect to another server. Let me know the best way to change all connections to new server.
0
Comment
Question by:subhashpunia
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 18

Expert Comment

by:Dennis Aries
ID: 34135212
In your project, add a config-file.

Use the configfile to store the needed information.
The single-paged http://www.codeproject.com/KB/dotnet/config.aspx shows a very easy example. The page is for c#, but it will not be too hard to convert it to vb.net

You could even watch http://www.youtube.com/watch?v=zp7oyrfdnL4. Some people put everything on youtube ;)
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
ID: 34163423
The easier approach is to use the Settings tab on Project Properties. Just add a setting and set its value. Later, you can either change the value in VS or using a text editor. You would then use this setting in code and wont need to change the code if the connectionstring changes. For example

Dim dbcon as new SqlConnection(My.Settings.MyConnectionString)
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question