惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

I
InfoQ
C
CERT Recently Published Vulnerability Notes
The Last Watchdog
The Last Watchdog
P
Proofpoint News Feed
D
Darknet – Hacking Tools, Hacker News & Cyber Security
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
GbyAI
GbyAI
T
Tenable Blog
博客园 - 三生石上(FineUI控件)
P
Privacy & Cybersecurity Law Blog
Simon Willison's Weblog
Simon Willison's Weblog
Jina AI
Jina AI
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
Tor Project blog
博客园_首页
F
Fortinet All Blogs
博客园 - Franky
Latest news
Latest news
Last Week in AI
Last Week in AI
T
Threat Research - Cisco Blogs
Scott Helme
Scott Helme
L
LINUX DO - 热门话题
U
Unit 42
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Hugging Face - Blog
Hugging Face - Blog
D
Docker
Project Zero
Project Zero
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
MongoDB | Blog
MongoDB | Blog
F
Full Disclosure
D
DataBreaches.Net
Google DeepMind News
Google DeepMind News
Cisco Talos Blog
Cisco Talos Blog
Y
Y Combinator Blog
WordPress大学
WordPress大学
C
Cyber Attacks, Cyber Crime and Cyber Security
H
Help Net Security
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
月光博客
月光博客
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Blog — PlanetScale
Blog — PlanetScale
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
S
Schneier on Security
C
Cybersecurity and Infrastructure Security Agency CISA
P
Proofpoint News Feed
PCI Perspectives
PCI Perspectives
Cloudbric
Cloudbric
V
Visual Studio Blog
Recorded Future
Recorded Future
人人都是产品经理
人人都是产品经理

博客园 - dn

[2008年]毕业论文格式要求 《面向.NET的XML程序设计》MAC模拟题 《基于C#的Windows应用程序设计》MCP认证考试模拟题 第六章课后习题及答案 第五章课后习题及答案 第四章课后习题及答案 毕业设计论文封面模板 在C#程序设计中使用Win32 API 第三章课后习题和答案 第三章例题:文件许可 第三章例题:为控件添加设计时支持 第三章例题:重载控件属性 第三章例题:自定义控件 毕业论文格式 第二章课后习题及答案 第二章例题:验证处理 第二章例题:动态添加控件 [2007年]毕业设计:bluehill人事管理系统 快速导航
.NET中常用的连接字符串
dn · 2007-04-16 · via 博客园 - dn

OLE DB, OleDbConnection (.NET)

密码连接:

Provider=sqloledb;Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;
Password
=myPassword;

window身份认证:

Provider=sqloledb;Data Source=myServerAddress;Initial Catalog=myDataBase;
Integrated Security
=SSPI;

Use serverName\instanceName as Data Source to use a specific SQL Server instance. Please note that the multiple SQL Server instances feature is available only from SQL Server version 2000 and not in any previous versions.

IP 地址连接:

Provider=sqloledb;Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;
Initial Catalog
=myDataBase;User ID=myUsername;Password=myPassword;

DBMSSOCN=TCP/IP. This is how to use TCP/IP instead of Named Pipes. At the end of the Data Source is the port to use. 1433 is the default port for SQL Server.

Prompt for username and password:

oConn.Provider = "sqloledb"
oConn.Properties(
"Prompt"= adPromptAlways

Data Source
=myServerAddress;Initial Catalog=myDataBase;

This one is a bit tricky. First set the connection object's Provider property to "sqloledb". Thereafter set the connection object's Prompt property to adPromptAlways. Then use the connection string to connect to the database.

SqlConnection(.NET)

密码连接:
1、

Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;
Password
=myPassword;

2、

Server=myServerAddress;Database=myDataBase;User ID=myUsername;
Password
=myPassword;Trusted_Connection=False;

This connection string produce the same result as the previous one. The reason to include it is to point out that some connection string keywords have many equivalents.

window身份认证:
1、

Data Source=myServerAddress;Initial Catalog=myDataBase;
Integrated Security
=SSPI;

2、

Server=myServerAddress;Database=myDataBase;
Trusted_Connection
=True;

Use serverName\instanceName as Data Source to use a specific SQL Server instance. Please note that the multiple SQL Server instances feature is available only from SQL Server version 2000 and not in any previous versions.

IP地址连接:

Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;
Initial Catalog
=myDataBase;User ID=myUsername;Password=myPassword;

Specifying packet size:

Server=myServerAddress;Database=myDataBase;User ID=myUsername;
Password
=myPassword;Trusted_Connection=False;Packet Size=4096;

By default, the Microsoft .NET Framework Data Provider for SQL Server sets the network packet size to 8192 bytes. This might however not be optimal, try to set this value to 4096 instead.