Can you ZAP or PACK a vfp free table through BO?


Author
Message
Marcel Heitlager
Marcel Heitlager
StrataFrame User (202 reputation)StrataFrame User (202 reputation)StrataFrame User (202 reputation)StrataFrame User (202 reputation)StrataFrame User (202 reputation)StrataFrame User (202 reputation)StrataFrame User (202 reputation)StrataFrame User (202 reputation)StrataFrame User (202 reputation)
Group: StrataFrame Users
Posts: 84, Visits: 835
Hi,



I'm trying to delete all the records in a VFP free table. Doing the deleting is no problem, but I want them permanently deleted, like ZAP or PACK.

Can you do something like below but with the PACK or ZAP command? I know it's a stupid question but I'm stuck.



thanks,

Marcel





Dim LoConn As New OleDb.OleDbConnection

LoConn.ConnectionString = MicroFour.StrataFrame.Data.DataLayer.DataSources("myKey").ConnectionString

LoConn.Open()

Dim loCommand As New OleDb.OleDbCommand("SET DELETED OFF", loConn)

loCommand.ExecuteNonQuery()


Marcel Heitlager
Marcel Heitlager
StrataFrame User (202 reputation)StrataFrame User (202 reputation)StrataFrame User (202 reputation)StrataFrame User (202 reputation)StrataFrame User (202 reputation)StrataFrame User (202 reputation)StrataFrame User (202 reputation)StrataFrame User (202 reputation)StrataFrame User (202 reputation)
Group: StrataFrame Users
Posts: 84, Visits: 835
OK,



So I did some more digging and did the obvious thing after "PACK" didn't work:





LoConn.ConnectionString = MicroFour.StrataFrame.Data.DataLayer.DataSources("myKey").ConnectionString

LoConn.Open()

Dim loCommand As New OleDb.OleDbCommand("PACK myFreeTable.dbf", loConn)

loCommand.ExecuteNonQuery()





Including the table name seems to work. So I guess to do something like ZAP I just have to delete all the records and do a PACK and put it in a myBO.Zap function.

Am I missing anything?



Thanks,



Marcel
Michel Levy
Michel Levy
StrataFrame User (441 reputation)StrataFrame User (441 reputation)StrataFrame User (441 reputation)StrataFrame User (441 reputation)StrataFrame User (441 reputation)StrataFrame User (441 reputation)StrataFrame User (441 reputation)StrataFrame User (441 reputation)StrataFrame User (441 reputation)
Group: StrataFrame Users
Posts: 193, Visits: 9K
Hi Marcel,

Are you sure your table is open EXCLUSIVE?

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
You will have to open the table exclusively, but there is more. You need to create all of the commands that you wish to execute within the same session. When trying to do a PACK or a ZAP, you need to set exclusive on and then execute the pack within the same query session. Also, when dealing with VFP OLEDB, be sure to check the supported list. Also, even if you are not on the latest version of VFP in development, get the most recent VFP OLEDB provider if you run into any issues.



Here is a list of supported commands:

http://msdn.microsoft.com/en-us/library/80x51c04(VS.80).aspx



Here is a sample of packing using OLEDB:

Dim cmd As New OleDbCommand("SET EXCLUSIVE ON;PACK MyTable.dbf")



MyBo.ExecuteNonQuery(cmd);




Don't hold me to it, but I think that will work. Smile
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search