写连接字符串时需要制定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";

相关文章:

  • 2022-01-29
  • 2021-07-26
  • 2021-07-18
  • 2022-02-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-11
猜你喜欢
  • 2022-03-04
  • 2022-12-23
  • 2021-07-03
  • 2021-08-21
  • 2021-11-26
  • 2022-12-23
相关资源
相似解决方案