none
怎么将如下vb6代码转换成vb2008? RRS feed

  • 问题

  • sub kkk

            Dim MyCnn As New ADODB.Connection

            With MyCnn
                .Provider = "microsoft.jet.oledb.4.0"
                .Open("Data Source =G:\vb 2008\paiban\paiban.mdb;Jet OLEDB:Database")
            End With
            '========================查找各项目参数生成数组
            Dim Rec As Long, sql As String
            Dim canshuArr()
            sql = "Select * from 岗位"
            Dim MyRs As New ADODB.Recordset
            With MyRs
                .Open(sql, MyCnn, adOpenKeyset, adLockOptimistic)
                Rec = .RecordCount
                If Rec <> 0 Then
                ReDim canshuArr(1 To Rec, 1 To 4)
                    .MoveFirst()
                    For i = 1 To Rec
                        canshuArr(i, 1) = .Fields(0)
                        canshuArr(i, 2) = .Fields(1)
                        canshuArr(i, 3) = .Fields(2)
                        canshuArr(i, 4) = .Fields(3)
                        .MoveNext()
                    Next
                End If
                .Close()
            End With
            MyCnn.Close()
        End Sub

    2011年5月18日 18:38

答案