asp.net 连接SQL2000数据库代码:情况1。SQLSERVER2000为没用户名和密码的windows登陆的:SqlConnection StudentInfConn = new SqlConnection("Data Source=localhost;Integrated Security=SSPI;" +"Initial Catalog=databaseName");
其中Integrated Security=SSPI表示windows登陆,databaseName为数据库名字。Data Source可用Server代替,localhost 表示本地,如果是远程主机就填主机名字。
情况2。有帐户和密码的登陆。SqlConnection StudentInfConn = new SqlConnection("Server=localhost;"+"user id=lui;password=yourPassword;" +"initial catalog=databaseName");其中initial catalog可用Database代替。注意:localhost有时候要用(local)代替。
以下是经过我测试通过的写:("Server=localhost;"+"user id=lui;password=myPassword;" +"initial catalog=databaseName");

相关文章:

  • 2021-11-20
  • 2022-02-01
  • 2022-01-18
  • 2021-11-13
  • 2021-11-16
  • 2021-10-04
  • 2021-12-13
  • 2021-10-02
猜你喜欢
  • 2022-12-23
  • 2021-11-30
  • 2021-12-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案