Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
OK, this might be a stupid question, but I have written a program on my PC and tested it on my PC & I now want to test it on my son's laptop before I send it to the person who I have written it for.

However, when I install it & run it on his PC it fails with SQL Server errors, and I guess that this is down to the fact that the program has a hard coded Connection in it that says "Data Source=MEDESKTOP;Initial Catalog=KAELC;Integrated Security=True" ... his PC is obviously not called MEDESKTOP, and I have no idea what the end user's PC will be called ...

How do I get around this problem ?!?
Posted

1 solution

Store your connection the application's configuration file and read it using the ConfigurationManager class in the System.Configuration assembly. This[^] link might be of use to you.
 
Share this answer
 
Comments
Gary Heath 24-Feb-12 18:55pm    
Still confused, I'm afraid Shameel. My database is created by SQL Server Data Centre edition, does that mean that a similar "level" of SQL Server will need to be installed on the recipient's PC ?

I suppose I am wondering if I should ignore this all-singing, all-dancing version of SQL Server & just use SQL Server Express ?!?!?
[no name] 25-Feb-12 1:36am    
If it is a standalone program that does not access the SQL Server database from a different server, then yes, you should go for the Express Edition.

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