i have c# windows application need connect sql server database , access tables, different windows account.(other logged in account)
what best approach this.
most commonly sql server, use integrated security, connection string this:
var connectionstring = string.format("data source={0};initial catalog={1};integrated security=sspi;", hostname, databasename);
if need connect different user, you're not logged in as, need specify username / password combination in connection string, this:
var connectionstring = string.format("data source={0};initial catalog={1};user id={2};password={3};", hostname, databasename, anotherusername, anotherpassword);
Comments
Post a Comment