Click here to Skip to main content
14,242,971 members
Rate this:
Please Sign up or sign in to vote.
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; +

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

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);

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100