VB怎么样连接Visual Foxpro的数据库!请给个例子吧!

解决方案 »

  1.   

    How to do?? For example OK?
      

  2.   

    Dim Table_name As String
    Dim Path_t As String
    Me.CommonDialog1.Filter = "*.dbf|*.dbf"
    Me.CommonDialog1.ShowOpen
    If Me.CommonDialog1.FileName = "" Then Exit Sub
    Path_t = Left(Me.CommonDialog1.FileName, InStrRev(Me.CommonDialog1.FileName, "\") - 1)
    Table_name = Right(Me.CommonDialog1.FileName, Len(Me.CommonDialog1.FileName) - Len(Path_t) - 1)
    With Rs_Vfp
        If .State = 1 Then .Close
        .ActiveConnection = "Driver={Microsoft Visual FoxPro Driver};UID=;SourceDB=" & Path_t & ";SourceType=DBF;Exclusive=No;BackgroundFetch=Yes;Collate=Machine;Null=Yes;Deleted=Yes;"
        .CursorLocation = adUseClient
        .CursorType = adOpenDynamic
        .LockType = adLockBatchOptimistic
        .Source = "select * from " & Table_name
        .Open
    End With