Solved

Append text to DBF File in VB.net ala "Append From" FoxPro command

Posted on 2008-10-06
6
2,416 Views
Last Modified: 2013-11-24
Hi!! I am attempting to append text into a dbf of the same layout through VB.NET.

In foxPro I would use the "APPEND FROM mytable.txt delimited with tab" command for a tab delimited file for example and foxpro will append the text into the correct fields as long as the schema is identical.

Does anyone know how to do this though VB? I normally would use the Access .COM object and just do this in SQL but there is no equivelent to the FoxPro "Append From text" command that I know of in SQL

any help is appreciated
0
Comment
Question by:ND_2007
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 12

Expert Comment

by:jrbbldr
ID: 22654711
"Does anyone know how to do this though VB?"

While I don't doubt that there are gurus here who know VB in addition to VFP, why do you think that this is a question for a FP/VFP forum?     There is no question here regarding FP/VFP code or FP/VFP application development.

Maybe you should try posting your question to a forum related to your VB question.
0
 
LVL 29

Expert Comment

by:Olaf Doschke
ID: 22654745
an sql equivalent to append from is insert into table from (subquery), and it's suported by VFP9. While it needs a vfp source for the subquery, that source can be a cursor created by remote dta acess.

You may alos simply use what you know: foxpro's append from command, via oledb provider. If you store whatever source you have in VB to another dbf or tab delimited text file or some other formats supported by append.

Bye, Olaf
0
 
LVL 27

Accepted Solution

by:
CaptainCyril earned 250 total points
ID: 22656769
If you have VFP installed on the computer, you can use automation.

oGreatestDevelopmentTool = CREATEOBJECT("VisualFoxPro.Application")
WITH oGreatestDevelopmentTool
    .DoCmn("USE path\table")
    .DoCmn("APPEND FROM file.txt TYPE DELIMITED")
ENDWITH
RELEASE oGreatestDevelopmentTool

You can also open two SQLSTRINGCONNECTION in VB. One for the text file and one for the dbf. Read from one and append to the other. In FoxPro you can do that in one command also using SQLEXEC. I don't know how to do that in VB. I gave up on VB back in 1996 when I saw that working with databases in it is like scratching your left ear with your right hand.
0
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 
LVL 1

Author Closing Comment

by:ND_2007
ID: 31503609
thanks! - the automation was exactly what i was looking for.
0
 
LVL 1

Author Comment

by:ND_2007
ID: 22658955
Here's what ended up working for me. Much thanks to CaptainCyril and and everyone that responded

Dim oVFP = CreateObject("VisualFoxPro.Application")
With oVFP
                .DoCmd("USE " & sDBFpath)
                .DoCmd("APPEND FROM " & sTXTpath & " TYPE DELIMITED")
                oVFP.docmd("CLOSE ALL")
End With
oVFP = Nothing
0
 
LVL 29

Expert Comment

by:Olaf Doschke
ID: 22659620
Perhaps add an oVFP.Quit() before setting it Nothing. Else you're not quitting the VFP session, you'd find a vfp exe in the taks manager processes tab.

Bye, Olaf.
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

We were having a lot of "Heartbeat Alerts" in our SCOM environment, now "Heartbeat" in a SCOM environment for those of you who might not be familiar with SCOM is a packet of data sent from the agent to the management server on a regular basis, basic…
Many companies are making the switch from Microsoft to Google Apps (https://www.google.com/work/apps/business/). Use this article to learn more about what Google Apps has to offer and to help if you’re planning on migrating to Google Apps. It is …
Viewers will learn the different options available in the Backstage view in Excel 2013.
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…

726 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