?
Solved

Accessing Visual FoxPro DBF Files using VB.Net

Posted on 2004-03-30
5
Medium Priority
?
887 Views
Last Modified: 2008-02-26
Hi, I'm writing a program in Vb.Net that will edit data in some Visual FoxPro DBF Tables.  I can create the connection without a hitch, however, I cannot generate the update/Add statements for the data table as VB.Net says it cannot identify the primary key for the DBF table.  The FoxPro tables are taken from an outside source and as such I can't open them with any other software to try to manually add primary keys to it.  I can happily view the table structure so I know what the fields are, and I know which field SHOULD be the primary key field for that table, but I just can't get VB.Net to recognise it as such.  Any help or advice you can give me on this would be really helpful, as this is time critical.

Thanks in advance

Liteswitch
0
Comment
Question by:Liteswitch
  • 2
3 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 10723244
I assume that you are using the OleDb provider for Visual FoxPro.  You can manually create your own Update and Insert commands for the OleDbAdapter, but you will have to have some way of uniquely identifying the correct record to update.  Insert commands don't require a primary key, but the way that the wizard tries to generate the SQL it does.

Bob
0
 

Author Comment

by:Liteswitch
ID: 10755557
Thanks for that help so far.  I am trying to use OleDb for the connection yes.  In the FoxPro table, I do know what the primary key is and so I can uniquely identify each row in the table without a problem, but it is just creating the Update and Insert commend that I am having problems with.

How do I manually create these commands, rather than use the wizard?

Cheers,
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 800 total points
ID: 10756647
The OleDbAdapter has Update and Insert command properties in the Properties window.  To access them, expand each command property by clicking on the '+'.  Then you can enter in the Update and Insert SQL statements in the CommandText properties.  You can use the SQL builder by clicking on the <...> button.

Bob
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses
Course of the Month13 days, 11 hours left to enroll

755 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question