扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
Option Explicit Dim cn As New ADODB.Connection Dim rs As New ADODB.Recordset Dim m_FldsName() As String Private Sub Command1_Click() Dim II As Long Dim t As Single cn.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=广商;Data Source=SUPER" rs.Open "Select * from FldSet ", cn, adOpenKeyset Do Until rs.EOF = True rs.MoveNext Loop rs.MoveFirst t = Timer ReDim m_FldsName(rs.Fields.Count) For II = 0 To rs.Fields.Count - 1 m_FldsName(II) = rs.Fields(II).Name Next Do Until rs.EOF = True ReadFieldsNotOnErr "Err1" ReadFieldsNotOnErr "TableName" ReadFieldsNotOnErr "Err2" rs.MoveNext Loop MsgBox "NotErr:" & Timer - t On Error Resume Next rs.MoveFirst t = Timer Do Until rs.EOF = True ReadFieldsOnErr "Err1" ReadFieldsOnErr "TableName" ReadFieldsOnErr "Err2" rs.MoveNext Loop MsgBox "OnErr:" & Timer - t rs.Close cn.Close End Sub Private Sub ReadFieldsOnErr(FieldName As String) Dim v As Variant v = rs(FieldName).Value End Sub Private Sub ReadFieldsNotOnErr(FieldName As String) Dim II As Long Dim IsExists As Boolean Dim v As Variant IsExists = False For II = 0 To UBound(m_FldsName) - 1 If m_FldsName(II) = FieldName Then IsExists = True Exit For End If Next If IsExists = True Then v = rs(FieldName).Value End If End Sub =================================== |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者