Packing a FoxPro table via ODBC.net from VB.net 
Author Message
 Packing a FoxPro table via ODBC.net from VB.net

I'm writing a small program for a client which mainly updates a SQL Server
database. No problem there. However, there is an additional table that forms
part of a FoxPro system which I also have to update, and this is kind of new
territory here. The original designer of the table used the reserved work
"value" as a field name, and if I try to perform an UPDATE statement against
it then it gets rejected by ODBC. My only alternative is to delete and then
reinsert the record, which does actually work. However, because deleted
records in FoxPro are only marked as deleted I then need to "Pack" the table
to clear out the old record. Anybody know how to do this with the ODBC
driver? My only workaround at the moment has been to write a small FoxPro
utility that separately does the pack, but it would be soooo much tidier to
do it from the main VB.net app.


Wed, 13 Apr 2005 17:46:59 GMT  
 Packing a FoxPro table via ODBC.net from VB.net
Hi,

You can pack a VFP table with the code similar to the following:
        Dim cn As OdbcConnection
        cn = New OdbcConnection("Driver={Microsoft Visual FoxPro
Driver};SourceType=DBF;SourceDB=c:\dbfpath;")
        Dim mystring As String = "SET EXCLUSIVE ON;PACK Table1"
        Dim cmd As OdbcCommand = New OdbcCommand(mystring, cn)
        cn.Open()
        cmd.ExecuteNonQuery()
        cn.Close()

Here is a related article that you can check for more information:
HOWTO: Pack a Table Through the Visual FoxPro ODBC Driver (VFPODBC.dll)
http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q234756

Regards,
Elan Zhou
This posting is provided "AS IS" with no warranties, and confers no rights.
Got .Net?  http://www.gotdotnet.com



Thu, 14 Apr 2005 19:43:45 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. VB.NET ODBC.NET limitations solved DSN list / Tables list

2. Packing a FoxPro Data Table via VB

3. Pack Foxpro tables via VBScript?

4. Connecting a VB.Net to a database via ODBC

5. VBS accessing foxpro db/tables via odbc

6. Need help creating Fox 2.5 table via MS Visual FoxPro ODBC driver

7. VB.NET updating three tables at once via a datagrid

8. what create table using ADO.NET to VB.NET

9. Packing a FoxPro Table from VB Application *HELP*

10. Packing a FoxPro Table from VB Application *HELP*

11. VB + ADO + FOXPRO DB + PACK TABLES & DATABASE

12. VB.NET: Steps for Converting a Windows .NET Application to a Web .NET Application

 

 
Powered by phpBB® Forum Software