Click here to Skip to main content
15,896,915 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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
Updated 10-Feb-13 6:09am
v2

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.
 
Share this answer
 
Comments
Sandeep Mewara 10-Feb-13 14:21pm    
Exactly. My 5.
Abhinav S 11-Feb-13 0:32am    
Thank you.
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
 
Share this answer
 
Comments
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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900