Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Packing of dbf file in ADO ?
Message
From
02/03/2004 13:00:30
Cindy Winegarden
Duke University Medical Center
Durham, North Carolina, United States
 
 
To
02/03/2004 11:09:18
Cindy Winegarden
Duke University Medical Center
Durham, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00877587
Message ID:
00882392
Views:
16
>>>>Any way for ADO 2.5/2.6 to pack dbf file ?
>>>
>>>Chatter is an odd place for a question like this.
>>>
>>>Perhaps the following KB article with help: http://support.microsoft.com/?kbid=234756, "HOWTO: Pack a Table Through the Visual FoxPro ODBC Driver (VFPODBC.dll)."
>
>>Thank for the advise, but I using VB6 with ADO,
>>hence the KB articles does not applied.
>
>The KB article shows the SQL command which packs the table - "SET EXCLUSIVE ON;PACK TableName". In other words, you can send two commands at onece by separating them with a semicolon. I'm going to see if it works when accessing VFP data either by ODBC or OLE DB. Generally, OLE DB does everything that ODBC did, and then adds some new functionality.

The following worked for me in VB6:
Sub Main()

    Dim cnConn As ADODB.Connection
    Dim cmdCommand As ADODB.Command
    
    Set cnConn = New ADODB.Connection
    cnConn.Open "User ID=;DSN=;" & _
         "Cache Authentication=False;Data Source=""C:\MY DOCUMENTS\VISUAL FOXPRO PROJECTS\TEST.DBC"";" & _
         "Password=;Provider=""VFPOLEDB.1"";Collating Sequence=MACHINE;Mask Password=False;Mode=Share Deny None;" & _
         "Extended Properties=;Encrypt Password=False;Exclusive='ON'"
    
    Set cmdCommand = New ADODB.Command
    cmdCommand.CommandType = adCmdText
    cmdCommand.CommandText = "PACK TestPack.dbf"
    Set cmdCommand.ActiveConnection = cnConn
    cmdCommand.Execute 
    
End Sub
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform