Click here to Skip to main content
15,906,328 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Good afternoon sir,
I m Dinesh..
i m creating a project in ADO.NET with SQL server 2005 as a back end..
i have a question that after deploying my project for installation on OTHER machine..will my program give me error if destination machine server name does not match with my server name which i have used in my application..??

i used this code:

Data Source=Dinesh; Initial Catalog=college_Management_System; User ID=sa; Password=*****;


plz reply me sir soon...Confused | :confused:

Dinesh92
Posted
Updated 5-Feb-12 22:36pm
v2

Yes.
You have to refer to the correct SQL Server instance, or it will fail.
Normally, you would but this into a configuration file, so that you do not have to change your code for each installation.
 
Share this answer
 
Comments
[no name] 6-Feb-12 8:17am    
so..will i have to change my code (i.e Data source=xyz; Initial catalog=pqr;....) according to destination machine configuration...???
OriginalGriff 6-Feb-12 8:25am    
Yes.
[no name] 6-Feb-12 8:29am    
but how...???
because i have created an installation file of that application...
OriginalGriff 6-Feb-12 8:32am    
As I said: "Normally, you would but this into a configuration file, so that you do not have to change your code for each installation." The installation program should locate the DB server and set the configuration data.
[no name] 6-Feb-12 8:39am    
suppose i have created my installation file according to my machine server configuration (i.e. Data source=Dinesh and etc etc..)..and i m going to install on another machine on which the SQL server is already installed...and then if i install my application on that machine and i run it...will i still get an error...????
You will surely get an error if the name doesn't match. At least you'll see "Cannot connect to xyz" or s.th. similar.
Use a config file to store all DB credentials.

I'd suggest you start reading here:Managing Application Settings[^]

regards
Michel
 
Share this answer
 
Comments
[no name] 6-Feb-12 8:16am    
so..will i have to change my code (i.e Data source=xyz; Initial catalog=pqr;....) according to destination machine configuration...???

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