Welcome! Log In Create A New Profile

Advanced

Import from DBF

Posted by ICI 
ICI
Import from DBF
October 21, 2009 10:32PM
Here is my solution how to import data from DBF with very little code.
I hope this will be very useful. I love to use it with Progress-Bar so I put code here
if you also love to see what happening with your data.

Button code, on click:
dsKontaQuery is Data Source

//Same name can not be for DBF and for one into analysis THEN alias will be KTA 
HDBOpen("KTA","KTA","C:\IMPORT\KONTA.DBF")

sSql is string = "SELECT * FROM KTA"
IF NOT HExecuteSQLQuery(dsKontaQuery,hQueryDefault,sSql) THEN
	ErrorInfo(errFullDetails)
END

HCreation(Konta)
TableDisplay(TABLE_Konta,taStart)
nUkupno is int = HNbRec(dsKontaQuery)
nRbr is int =0

PROGBAR_ProgressBar1..MinValue=0
PROGBAR_ProgressBar1..MaxValue=nUkupno

HReadFirst(dsKontaQuery)
WHILE NOT HOut(dsKontaQuery)
	nRbr += 1
	PROGBAR_ProgressBar1 = nRbr
	Konta.Konto= dsKontaQuery.Konto
	Konta.Naziv_Konta=NoSpace(dsKontaQuery.kon_naz)
	HAdd(Konta)
	HReadNext(dsKontaQuery)
END
TableDisplay(TABLE_Konta,taStart)  //Re-display Table from start

And voila your DBF data are imported very very fast. Zooooomm.
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: