.net连接数据库的两种方式(windwos登录和sa登录)

用账号sa登录

<appSettings>
    <add key="cn" value="server=DESKTOP-NMFEE95;database=netxinwenfabuxns;uid=sa;pwd=123456;"/>
  </appSettings>

用windows登录

"server=.;Initial Catalog=WebTest;Integrated Security=true"
连接字符串中的integrated security=true的意思是什么
integrated security=true 的意思是集成验证,也就是说使用Windows验证的方式去连接到数据库服务器。这样方式的好处是不需要在连接字符串中编写用户名和密码,从一定程度上说提高了安全性。

<configuration>
  <appSettings>
    <add key="cn" value="server=DESKTOP-NMFEE95;database=netxinwenfabuxns;Integrated Security=true"/>
  </appSettings>
  <connectionStrings/>
发布了70 篇原创文章 · 获赞 1 · 访问量 528

猜你喜欢

转载自blog.csdn.net/zhupengqq1/article/details/103925338