c# - How to set SQL Server connection string? -
i'm developing simple c# application, i'd know this: when connect application sql server on pc, know connection string (server name, password etc.), when connect pc, sql server connection string different. there common account in sql server come default account can connect? have heard sa
account in sql server, sa
?
// .net dataprovider -- standard connection username , password
using system.data.sqlclient; sqlconnection conn = new sqlconnection(); conn.connectionstring = "data source=servername;" + "initial catalog=databasename;" + "user id=username;" + "password=secret;"; conn.open();
// .net dataprovider -- trusted connection
sqlconnection conn = new sqlconnection(); conn.connectionstring = "data source=servername;" + "initial catalog=databasename;" + "integrated security=sspi;"; conn.open();
Comments
Post a Comment