Solved

Accessing Visual FoxPro DBF Files using VB.Net

Posted on 2004-03-30
5
857 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
5 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 200 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MVC DDL Json Not Binding to Model 2 27
Change to file doesn't show up 16 55
Code works but breaks when I add one section 4 20
IDE for Python 5 25
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

830 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