SQL数据库连接字符串的几种写法整理

一、远程连接

1.sql server 身份验证 连接字符串 :

private string ConnstrSqlServer = "server=服务器名称;uid=登录名称;pwd=登录密码;database=数据库名称";

2.windows 身份验证连接字符串:

private string ConnstrWindows = "server=服务器名称;database=数据库名称;Trusted_Connection=SSPI";

二、本地连接

. 在 C# 代码中用 SqlClient 的方式访问 SQL Server 2008-2014 数据库        

1..NET Framework Data Provider for SQL Server 标准写法    

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

2. .NET Framework Data Provider for SQL Server 另一种标准写法    

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

3.NET Framework Data Provider for SQL Server 信任连接写法    

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

4.NET Framework Data Provider for SQL Server 信任连接另一种写法    

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

posted @ 2019-10-06 12:34  <--青青子衿-->  阅读(13191)  评论(0编辑  收藏  举报
// /**/ // 在页脚Html代码 引入 // function btn_donateClick() { var DivPopup = document.getElementById('Div_popup'); var DivMasklayer = document.getElementById('div_masklayer'); DivMasklayer.style.display = 'block'; DivPopup.style.display = 'block'; var h = Div_popup.clientHeight; with (Div_popup.style) { marginTop = -h / 2 + 'px'; } } function MasklayerClick() { var masklayer = document.getElementById('div_masklayer'); var divImg = document.getElementById("Div_popup"); masklayer.style.display = "none"; divImg.style.display = "none"; } setTimeout( function () { document.getElementById('div_masklayer').onclick = MasklayerClick; document.getElementById('btn_donate').onclick = btn_donateClick; var a_gzw = document.getElementById("guanzhuwo"); a_gzw.href = "javascript:void(0);"; $("#guanzhuwo").attr("onclick","follow('33513f9f-ba13-e011-ac81-842b2b196315');"); }, 900);