Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
Hi,
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 Source=dbRepHost.mssql.somee.com;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?
 

Thanks
Posted 10-Feb-13 7:08am
Edited 10-Feb-13 7:09am
ProgramFOX127.9K
v2
Rate this: bad
good
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.
  Permalink  
Comments
Sandeep Mewara at 10-Feb-13 14:21pm
   
Exactly. My 5.
Abhinav S at 11-Feb-13 0:32am
   
Thank you.
Rate this: bad
good
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
  Permalink  
Comments
Abhinav S at 11-Feb-13 0:31am
   
Sounds good. 5.
Espen Harlinn at 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
0 OriginalGriff 520
1 Maciej Los 290
2 Richard MacCutchan 265
3 BillWoodruff 265
4 Suraj Sahoo | Coding Passion 155
0 OriginalGriff 8,764
1 Sergey Alexandrovich Kryukov 7,437
2 DamithSL 5,639
3 Maciej Los 5,279
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web03 | 2.8.1411028.1 | Last Updated 10 Feb 2013
Copyright © CodeProject, 1999-2014
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