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

📄 mdproattributesx.htm

📁 ADO使用手册,非常详细
💻 HTM
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML dir=ltr>
<HEAD>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=gb2312"><title>Attributes 和 Name 属性范例</title>
<style>@import url(msdn_ie4.css);</style>
</HEAD>
<BODY>
<h3><a name="mdproattributesx"></a>Attributes 和 Name 属性范例</h3>
<p>
该范例显示 <b>Connection</b>、<b>Field</b> 和 <b>Property</b> 对象的 <b>Attributes</b> 属性值。它使用 <b>Name</b> 属性显示每个 <b>Field</b> 和 <b>Property</b> 对象的名称。</p>
<pre>Public Sub AttributesX   Dim cnn1 As ADODB.Connection
   Dim rstEmployees As ADODB.Recordset
   Dim fldLoop As ADODB.Field
   Dim proLoop As ADODB.Property
   Dim strCnn As String
   
   ' 打开连接和记录集。
   strCnn = "Provider=sqloledb;" &amp; _
      "Data Source=srv;Initial Catalog=pubs;User Id=sa;Password=; "
   Set cnn1 = New ADODB.Connection
   cnn1.Open strCnn
   Set rstEmployees = New ADODB.Recordset
   rstEmployees.Open "employee", cnn1, , , adCmdTable
   
   ' 显示连接的属性。
   Debug.Print "Connection attributes = " &amp; _
      cnn1.<span class=cfe><b>Attributes</b></span>   ' 显示雇员表字段的属性。
   Debug.Print "Field attributes:"
   For Each fldLoop In rstEmployees.Fields
      Debug.Print "   " &amp; fldLoop.<span class=cfe><b>Name</b></span> &amp; " = " &amp; _
         fldLoop.Attributes
   Next fldLoop   ' 显示是 NULLABLE 的雇员表的字段。
   Debug.Print "NULLABLE Fields:"
   For Each fldLoop In rstEmployees.Fields
      If CBool(fldLoop.Attributes And adFldIsNullable) Then
         Debug.Print "&nbsp;&nbsp; " &amp; fldLoop.<span class=cfe><b>Name</b></span>
      End If
   Next fldLoop   ' 显示雇员表属性的属性。
   Debug.Print "Property attributes:"
   For Each proLoop In rstEmployees.Properties
      Debug.Print "   " &amp; proLoop.<span class=cfe><b>Name</b></span> &amp; " = " &amp; _
         proLoop.<span class=cfe><b>Attributes</b></span>
   Next proLoop   rstEmployees.Close
   cnn1.CloseEnd Sub</pre>
<center> <A HREF="http://www.51windows.Net">www.51windows.Net</A></center>
<SCRIPT LANGUAGE="JavaScript" src="/log/sitelog2.asp"></SCRIPT>
<script src="script.js"></script></BODY>
</HTML>

⌨️ 快捷键说明

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