Click here to Skip to main content
15,886,137 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,
I have a big problem. I made a C# program that connects to a SQL-Server database that is found on the local system (on the same computer) but my problem is that I want to publish my project so that it will be installed on any computer without having to install the full version of SQL-Server and also without having to change the connection line which is hard coded. Is there a way to do this ????? Thanks in advance .
Posted
Comments
Boipelo 30-Aug-13 19:49pm    
You can still create a config file so you are able to change the connection string at will. I dont see another way. At least you have learn not to hard code the connection string in your application.

1 solution

Move your connection string to the app.config file. You can then change the connection string to put the server name or IP address that the SQL Server is on in that. I usually use easily replaceable tags in the connection string to put in a username and password for the application to use. These values was either be entered by the user or encrypted and stored separate from the connection string.
 
Share this answer
 
Comments
Sammy FCI 31-Aug-13 15:43pm    
Ok but does this mean that the user of the program must have SQL - Server application installed on his computer if he wishes to work on the local host or is there a kind of lite SQL that can be placed in the published pacakage of the program so that when the program is installed a lite version of sql server is installed too ?? If there is a lite version please give me the link to it. Thanks in advance
Dave Kreskowiak 31-Aug-13 16:31pm    
SQL Server Express. Google it.

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