Solved

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

Posted on 2010-11-15
2
360 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

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

707 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