⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 52934.htm

📁 一本很基础的SQL讲解
💻 HTM
字号:
<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">用代码刷新ODBC链接SQL Server表</td>      </tr>      <tr>        <td height="3" bgcolor="#E3E3E3"></td>      </tr>      <tr>        <td>&nbsp;</td>      </tr>      <tr>        <td class="d_font4"><P><STRONG>问:</STRONG>在用MDB与SQL Server 2000链接时,有时需要刷新链接表,如何简洁方便地完成? </P>
<P><STRONG>答:</STRONG>通过以下代码可以达到目的:</P>
<P>
<TABLE cellSpacing=0 borderColorDark=#ffffff cellPadding=2 width=400 align=center borderColorLight=black border=1>
<TBODY>
<TR>
<TD class=code bgColor=#e6e6e6><PRE>  Function relink()<BR>&nbsp;<BR>  Dim db As Database<BR>  Dim tbl As TableDef<BR>  Dim a As String<BR>  Dim b As String<BR>  Dim d As String<BR>  <BR>  a = "sa"'数据库用户<BR>  b = "abc"'数据库口令<BR>  d = "abcde"'数据库名称<BR>  Set db = CurrentDb<BR>  For Each tbl In db.TableDefs<BR>  If tbl.Attributes = 536870912 Then<BR>  tbl.Connect = "FILEDSN=d:demosteel.dsn;UID=" &amp; a &amp; ";<BR>PWD=" &amp; b &amp; ";WSID=;DATABASE=" &amp; d &amp; ";Network=DBMSSOCN" '<BR>  tbl.Attributes = dbAttachSavePWD<BR>  tbl.RefreshLink<BR>  End If<BR>  Next<BR>  End Function </PRE></TD></TR></TBODY></TABLE></P>
<P>问题解答如下:    </P>
<P>1、DSN=gnts中gnts是系统DSN的文件名。 </P>
<P>2、UID是用户名,并且它的值由变量a的值决定。PWD是密码,并且它的值由变量b的值决定。 </P>
<P>3、WSID是指工作站的ID号 (Workstation ID)。变量d的值表示数据库的名称。Network=DBMSSOCN指TCP/IP所使用的网络库(Network Library)。</P>
<P><FONT size=4>【相关文章】</FONT></P>
<UL type=disc>
<LI><A href="http://database.51cto.com/art/200706/50241.htm" target=_blank><U><FONT color=blue>如何对SQL Server数据表和数据库进行迭代操作</FONT></U></A></LI></UL>
<UL type=disc>
<LI><A href="http://database.51cto.com/art/200704/46420.htm" target=_blank><U><FONT color=blue>SQL Server如何访问sybase数据库的表</FONT></U></A></LI></UL>
<UL type=disc>
<LI><A href="http://database.51cto.com/art/200704/46306.htm" target=_blank><U><FONT color=blue>动态创建SQL Server数据库表存储过程</FONT></U></A></LI></UL>
<DIV align=right>【责任编辑:<A class=ln href="mailto:sunsj@51cto.com">火凤凰</A> TEL:(010)68476606-8036】</DIV></td>      </tr>      <tr>        <td class="d_font4">&nbsp;</td>      </tr>    </table>

⌨️ 快捷键说明

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