tags:

views:

32

answers:

1

i am new to program,and our teacher asked us to write a small program witch using sqlserver; so i use visual studio 2010 c# to write it,but i meet a problem: i don't know how to make a setup file.because i put the SqlConnectionString in the code file directly;so,even i have publish the program ,the sqlconnectionstring didn't change,it didn't works~ this is the first time to write this kind program,and i dont know how to make it work right on others computer; can you tell me the way to solve it? do i need change the way of coding?how? thanks~

+2  A: 

Put the connection string in the config file, that way it can be updated without needing a recompile. The easiest way to do that is to open the Properties folder in the Solution Explorer and then doubleclick on the Settings.settings file, then you get a easy to use interface to create a config file value that you can later reference in your code without needing to write any code for reading the config file.

ho1
so how to install the sqlserver database?import it into the users computer?
magicshui
@user353998 - Look at my answer in this question: http://stackoverflow.com/questions/2712118/how-to-deploy-vb-net-application-with-databasesqlserver/2713272#2713272
ho1