您的位置:首页 > 数据库

Sql Server连接字符串

2012-06-09 16:26 162 查看
  写连接字符串时需要制定server(连接到哪一台电脑),database(连接到哪一个数据库)

一、使用SqlConnection对象时,需要指定连接字符串,下面是相关介绍:

uid(用户名),pwd(登陆密码),Integrated Security(连接协议true或SSPI),Initial Catalog

(连接到的数据库).下面是一些实例:

1

string connectionString = "server = 304b2;database = students; uid = sa; pwd = ";
//304b2是本机名字,还可以是用local或 . 或 127.0.0.1


2

string connectionString = "server = .;database = students;Integrated Security = SSPI";


3

string connectionString = "server = .;Initial catalog= students;Integrated Security = SSPI";
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: