473,385 Members | 1,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Packing FoxPro tables with VB.NET

Hi! Bill,

Actually I am using the following code to pack my FoxPro tables (Not
Visual FoxPro tables). You know when you delete records from FoxPro
they are just marked for deletion and don't get permanently deleted
unless you issue pack command in FoxPro. So I am using the following
snippet to achieve that. Now the problem is that everything works and
the records actually get deleted but my program hangs on the
cmd.ExecuteNonQuery() command. So can you tell me what am I doing
wrong.
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()
cheers

SY
Nov 20 '05 #1
2 2588
Hi Sajid,

I think it is the best to ask this in a Microsoft.public Foxpro newsgroup.

At least Cindy W. who is active there knows too from vb.net.

Cor
Nov 20 '05 #2
In news: ux**************@TK2MSFTNGP11.phx.gbl,
Cor Ligthert <no**********@planet.nl> wrote:
I think it is the best to ask this in a Microsoft.public Foxpro
newsgroup.

At least Cindy W. who is active there knows too from vb.net.


Hi Cor and Sajid,

The following works for a table named C:\TestPack:

Imports System
Imports System.Data.OleDb

Module Module1

Sub Main()

Try

Dim cn As OleDbConnection

cn = New OleDbConnection("Provider=VFPOLEDB.1;Data Source=C:\;"
& _
"Mode=Share Deny None;Extended Properties="""";User
ID="""";" & _
"Mask Password=False;Cache Authentication=False;Encrypt
Password=False;" & _
"Collating Sequence=MACHINE;Exclusive=ON;DSN=""""")

Dim cmd As OleDbCommand = New OleDbCommand("Pack TestPack", cn)

cn.Open()
cmd.ExecuteNonQuery()
cn.Close()

Catch e As Exception

MsgBox("Exception")

End Try

End Sub

End Module
--
Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP
ci**************@mvps.org www.cindywinegarden.com
Nov 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Kimo | last post by:
Hi I develope an application in VB.Net. I want to connect to foxpro database. I use the following code Tr Dim cnn As New OleDbConnectio cnn.ConnectionString = "Provider=VFPOLEDB.1;" + "Data...
1
by: jdola | last post by:
I have a customer that is using Access to create reports from FoxPro tables. We started noticing problems with the indexes on the FoxPro tables. It is to the point where we have to delete and...
13
by: Simon Bailey | last post by:
I am a newcomer to databases and am not sure which DBMS to use. I have a very simplified knowledge of databases overall. I would very much appreciate a (simplifed) message explaining the advantages...
2
by: Salad | last post by:
OS = WinXP & Win98. Access = A97 & AXP Q1) Where can I find the VFP ODBC driver at Microsoft. I have been working developing an app in Access that will link to some DOS FoxPro tables. I...
3
by: Pete Kane | last post by:
Hello there, just been thrown in the deep end with .NET, I need to perform the equivalent of "Set Relation" using CSharp and ADO.NET on two Foxpro tables. My basic needs are: Open two Foxpro...
3
by: Amar | last post by:
I have a abc.PRG file in visual foxpro 8.0. I can run this file using visual foxpro environment and it creates a table X.dbf in the same folder where this program file is and populates some data...
9
by: cj | last post by:
I'm trying to forge ahead with Visual Basic .Net but recently I've suffered several major set backs in demonstrating VB is the future and we should move from Visual FoxPro. I really need to find...
1
by: catudalg | last post by:
Configuration: Windows 2000 sp3 MS Access 2000 (9.0.4402 SR-1) Visual Foxpro 9.0 detached tables MS VFP Driver 6.01.6830.01 06/19/2003 For example, a simple query like: select * from ddwg1...
3
by: HistoricVFP | last post by:
Hello, I’ve been given the task of importing .dbf files from a very old version of Visual FoxPro (version 2.1) into Access (2003). When I import the data straight to Access it errors with: ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.