Click here to Skip to main content
15,885,885 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i need your help .i made a desktop application i used sql server 2008 r2 for my database
in connection string used sql user name pass etc
if i made exe file of that app and run on another system ho can get pc name ,sql user name and pass of that system automatically

;User id=sa; +
;Password=golden3952; +
;MultipleActiveResultSets=True;
Posted

1 solution

This is very simple string manipluation.

This is easily done with String.Format()...
string template = "Data Source={0};Initial Catalog={1};User ID={2};Password={3};"

string connectionString = string.Format(template, serverName, databaseName, userId, password);
 
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