Connection To SQL Server
How to use C# to connect to the SQL Server, there is a connection string we can use:
string conn = "Integrated Security=false; Data Source=****;Initial Catalog=****;User ID=****;Password=****"; |
Data Source (Server; Address ; Addr ; Network Address):
The name or network address of the instance of SQL Server to
which to connect. The port number can be specified after the
server name:
server=tcp:servername, portnumber
When specifying a local instance, always use (local).
Initial Catalog (Database): The name of the
database.
Integrated Security (Trusted_Connection): By default, it
is false, and User ID and Password are specified in the
connection. When true, the current Windows account credentials
are used for authentication.
To ensure that connections are always closed, open the …
[获取更多]