Click here to Skip to main content
11,928,987 members (53,955 online)
Rate this:
Please Sign up or sign in to vote.
See more: VB SQL-Server Visual-Studio , +
I have a winforms application that uses SQL Server Databases. The connection string in data source is something like

Data Source=Office1\SQLEXPRESS;Initial Catalog=dbRepHost;Integrated Security=True

Now I have hosted the DBs on a web server to access the online DBs. I have attached the DBs.

The new required connection string is
Data;Initial Catalog=dbRepHost;Persist Security Info=True;User ID=nouman;Password=abc123

My question is if it is enough to change the connection string in app.config file or I need to edit all data sets to and change the connection string?

Posted 10-Feb-13 7:08am
Edited 10-Feb-13 7:09am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Ideally, if you have done your coding right, you should only need to change App.Config and nothing else.
That is exactly the benefit of storing connection string in App.Config.

If not, you should look at changing your code so that you pick up the connection string from this file.
Sandeep Mewara 10-Feb-13 14:21pm
Exactly. My 5.
Abhinav S 11-Feb-13 0:32am
Thank you.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

From the look of your new connection string, it looks like you're hosting it somewhere on the internet.

Microsoft SQL Server requires certain ports to be opened to communicate over a firewall. The default SQL Server port is 1433, and client ports are assigned a random value between 1024 and 5000.

Now if this server is on the internet: *don't open those ports*, unless you know what you are doing.

Please read Encrypting Connections to SQL Server[^] - or even better: Expose you datalayer as a web-service, and use SSL to communicate with that web service.

Best regards
Espen Harlinn
Abhinav S 11-Feb-13 0:31am
Sounds good. 5.
Espen Harlinn 11-Feb-13 4:27am
Thank you, Abhinav :-D

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.151126.1 | Last Updated 10 Feb 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100