Advertisement
2002ASP Databases/ Data Access/ DAO/ ADO #5129

Quick Recordset Properties List

If you're ever wondering what's contained in a recordset you currently have open, here's a quick and dirty way to dump all the data you could want to the Immediate window, which you can view there, or copy and paste into a notepad document or other textfile for printing, etc. I like to keep this somewhere I can quickly copy and paste it into any module or routine that uses a recordset in case I lose track of which field is which. (I've only tried this with VB 6.0 and AO 2.6, but I imagine it would work with other versions.) --Brian Battles WS1O Middletown, CT USA

AI

AI 摘要: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

源代码
original-source
Private Sub ListRecordsetProperties()
  ' provides a list of all current recordset fields and their properties;
  ' use with any currently open ADO recordset (rs in this example)
  Dim I As Integer
  Dim J As Integer
  
  For I = 0 To rs.Fields.Count - 1
    Debug.Print vbCrLf & "Field " & I & " Name: '" & rs.Fields.Item(I).Name & "'" & vbTab & "Value: '" & rs.Fields(I).Value & "'" & vbCrLf & " Properties..."
    For J = 0 To rs.Fields(I).Properties.Count - 1
      Debug.Print "  Index(" & J & ") " & "Name: " & rs.Fields(I).Properties(J).Name & " = " & rs.Fields(I).Properties(J).Value & vbTab & vbTab & "Type: " & rs.Fields(I).Properties(J).Type & "," & vbTab & "Attributes: " & rs.Fields(I).Properties(J).Attributes
    Next J
  Next I
End Sub
原始评论 (3)
从 Wayback Machine 恢复