Click here to Skip to main content
15,891,567 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
when i write a database program and i want to use it in another system i must change the connection string of my program to run it in that system.for this problem how can i get server name,user id and pass of sql server of the system i installed my program on it in my code?? i know i can use
SQL
SqlConnectionStringBuilder


but i dont want to get server name,user id,pass from user

TIA
Posted
Updated 5-Jan-12 22:28pm
v3

You can't get the user ID or password from any electronic source - there are there to stop people who aren't authorised to use the system gaining access, so a simple method to get them does not make much sense. Would you think it a good idea to print your PIN number in large digits on the front of your bank card?

You can get a list of available servers - that's pretty easy - but you have to ask someone for the access details to use whichewver one they select.
 
Share this answer
 
Comments
arashmobileboy 6-Jan-12 5:31am    
thanks,but how some programs that i get in internet that uses sql server,works fine without entering any server,....(maybe i thought wrong)
When you run the script that creates the database your application uses on the clients instance of sql server, you should also create the appropriate users with their permissions that can access that database at the same time. You then should have all the necessary information to create the correct connectionStrings in the appropriate settings file.
 
Share this answer
 

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