不好意思,问一极菜的问题,VB与FoxPro应该怎么连接,不知能否给个好用的例子,谢谢!!!

解决方案 »

  1.   

    Visual FoxPro 
     OLE DB, OleDbConnection (.NET) 
     Database container (.DBC):"Provider=vfpoledb.1;Data Source=C:\MyDbFolder\MyDbContainer.dbc;Password=MyPassWord;Collating Sequence=machine"  Free table directory:"Provider=vfpoledb.1;Data Source=C:\MyDataDirectory\;Password=MyPassWord;Collating Sequence=general" 
    Read more (Microsoft msdn) >>
     ODBC 
     Database container (.DBC):"Driver={Microsoft Visual FoxPro Driver};SourceType=DBC;SourceDB=c:\myvfpdb.dbc;Exclusive=No;Collate=Machine;"  Free Table directory:"Driver={Microsoft Visual FoxPro Driver};SourceType=DBF;SourceDB=c:\myvfpdbfolder;Exclusive=No;Collate=Machine;" 
    "Collate=Machine" is the default setting, for other settings check the list of supported collating sequences >>
      

  2.   


    莫依兄,这是我按你说的写的测试是否连上FOXPRO数据库的一段程序,为什么还是弹出“数据库连接出错”呢?请帮帮忙看看错在哪里,谢谢!!
    Dim conn As ADODB.Connection
    Dim rs As New ADODB.Recordset
    Private Sub Form_Load()On Error GoTo err_deal'conn.ConnectionString = "Driver={Microsoft Visual FoxPro Driver};SourceType=DBC;SourceDB=e:\test\foxpro\users.dbc;Exclusive=No;Collate=Machine;"
    conn.ConnectionString = "Provider=vfpoledb.1;Data Source=e:\test\foxpro\users.dbc;Collating Sequence=machine"
    conn.Open
    strsql = "select * from users"
    Set rs = New ADODB.Recordset
    rs.CursorType = adOpenStatic
    rs.LockType = adLockReadOnly
    rs.Open strsql, conn, , , adCmdText
        
    Text1.Text = rs!idrs.Close
    Set rs = Nothing
    conn.Close
    Set conn = NothingExit Suberr_deal:
        If Err <> 0 Then
             MsgBox "连接数据库出错", vbExclamation, "连接数据库"
           Err.Clear
       End If
    End Sub