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

📄 mdmthsupportsx.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>Supports 方法范例</title>
<style>@import url(msdn_ie4.css);</style>
</HEAD>
<BODY>
<h3><a name="mdmthsupportsx"></a>Supports 方法范例</h3>
<p>
该范例使用 <b>Supports</b> 方法,显示用不同游标类型打开的记录集所支持的选项。运行该过程需要 DisplaySupport 过程。</p>
<pre>Public Sub SupportsX()   Dim aintCursorType(4) As Integer
   Dim rstTitles As ADODB.Recordset
   Dim strCnn As String
   Dim intIndex As Integer   ' 打开连接。
      strCnn = "Provider=sqloledb;" &amp; _
      "Data Source=srv;Initial Catalog=pubs;User Id=sa;Password=; "   ' 使用 CursorType 常量填充数组。
   aintCursorType(0) = adOpenForwardOnly
   aintCursorType(1) = adOpenKeyset
   aintCursorType(2) = adOpenDynamic
   aintCursorType(3) = adOpenStatic
   
   ' 使用每个 CursorType 和优化锁定打开记录集,
   ' 然后调用 DisplaySupport 过程显示所支持的选项。
   For intIndex = 0 To 3
      Set rstTitles = New ADODB.Recordset
      rstTitles.CursorType = aintCursorType(intIndex)
      rstTitles.LockType = adLockOptimistic
      rstTitles.Open "titles", strCnn, , , adCmdTable
      
      Select Case aintCursorType(intIndex)
         Case adOpenForwardOnly
            Debug.Print "ForwardOnly cursor supports:"
         Case adOpenKeyset
            Debug.Print "Keyset cursor supports:"
         Case adOpenDynamic
            Debug.Print "Dynamic cursor supports:"
         Case adOpenStatic
            Debug.Print "Static cursor supports:"
      End Select      DisplaySupport rstTitles
      rstTitles.Close
   Next intIndexEnd SubPublic Sub DisplaySupport(rstTemp As ADODB.Recordset)   Dim alngConstants(11) As Long
   Dim booSupports As Boolean
   Dim intIndex As Integer   ' 用游标选项常量填充数组。
   alngConstants(0) = adAddNew
   alngConstants(1) = adApproxPosition
   alngConstants(2) = adBookmark
   alngConstants(3) = adDelete
   alngConstants(4) = adFind
   alngConstants(5) = adHoldRecords
   alngConstants(6) = adMovePrevious
   alngConstants(7) = adNotify
   alngConstants(8) = adResync
   alngConstants(9) = adUpdate
   alngConstants(10) = adUpdateBatch
   
   For intIndex = 0 To 10
      booSupports = _
         rstTemp.Supports(alngConstants(intIndex))
      If booSupports Then
         Select Case alngConstants(intIndex)
            Case adAddNew
               Debug.Print "&nbsp;&nbsp; AddNew"
            Case adApproxPosition
               Debug.Print "&nbsp;&nbsp; AbsolutePosition and AbsolutePage"
            Case adBookmark
               Debug.Print "&nbsp;&nbsp; Bookmark"
            Case adDelete
               Debug.Print "&nbsp;&nbsp; Delete"
            Case adFind
               Debug.Print "&nbsp;&nbsp; Find"
            Case adHoldRecords
               Debug.Print "&nbsp;&nbsp; Holding Records"
            Case adMovePrevious
               Debug.Print "&nbsp;&nbsp; MovePrevious and Move"
            Case adNotify
               Debug.Print "&nbsp;&nbsp; Notifications"
            Case adResync
               Debug.Print "&nbsp;&nbsp; Resyncing data"
            Case adUpdate
               Debug.Print "&nbsp;&nbsp; Update"
            Case adUpdateBatch
               Debug.Print "&nbsp;&nbsp; batch updating"
         End Select
      End If
   Next intIndexEnd 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 + -