35423.htm

来自「一本很基础的SQL讲解」· HTM 代码 · 共 41 行

HTM
41
字号
<link href="./dzs_cs.css" rel="stylesheet" type="text/css" /><table width="96%" border="0" align="center" cellpadding="0" cellspacing="0">      <tr>        <td>&nbsp;</td>      </tr>      <tr>        <td height="24" align="center" valign="bottom" class="d_font3">SQL Server 数据库连接字符串的声明</td>      </tr>      <tr>        <td height="3" bgcolor="#E3E3E3"></td>      </tr>      <tr>        <td>&nbsp;</td>      </tr>      <tr>        <td class="d_font4"><P>连接字符串中常用的声明有: 
<P>服务器声明 Data Source、Server和Addr等。 
<P>数据库声明 Initial Catalog和DataBase等。 
<P>集成Windows账号的安全性声明 Integrated Security和Trusted_Connection等。 
<P>使用数据库账号的安全性声明 User ID和Password等。 
<P>对于访问数据库的账号来说,通常我们在一些参考资料上看到ADO.NET的字符串连接往往有如下写法: 
<TABLE cellSpacing=0 borderColorDark=#ffffff cellPadding=2 width=400 align=center borderColorLight=black border=1>
<TBODY>
<TR>
<TD class=code bgColor=#e6e6e6><PRE>string ConnStr = "server = localhost;
 user id = sa; password = xxx; database = northwind";</PRE></TD></TR></TBODY></TABLE>
<P>对于集成Windows安全性的账号来说,其连接字符串写法一般如下: 
<TABLE cellSpacing=0 borderColorDark=#ffffff cellPadding=2 width=400 align=center borderColorLight=black border=1>
<TBODY>
<TR>
<TD class=code bgColor=#e6e6e6><PRE>string ConnStr = "server = localhost; 
integrated security = sspi; database = northwind";
或string ConnStr = "server = localhost;
 trusted_connection = yes; database = northwind";</PRE></TD></TR></TBODY></TABLE>
<P>使用Windows集成的安全性验证在访问数据库时具有很多优势:安全性更高、访问速度更快、减少重新设计安全架构的工作、可以硬编码连接字符串等,还是很值得使用的。 </P>
<P>(责任编辑:铭铭 <A href="mailto: mingming_ky@126.com">mingming_ky@126.com</A> TEL:(010)68476636)</P></td>      </tr>      <tr>        <td class="d_font4">&nbsp;</td>      </tr>    </table>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?