|
Home → WEBDEV 2024 → Importing data from DBF file to HFSQL file is not successful |
Importing data from DBF file to HFSQL file is not successful |
Started by Cyril Fernandes, Dec., 26 2024 12:25 AM - 3 replies |
| |
| | | |
|
| |
Posted on December, 26 2024 - 12:25 AM |
BILL.DBF IS dbase/Foxpro file
BILLFILE is HFSQL file
Only a few number of records are added into HFSQL file
I'm using WEBDEV 20 Version
HERE'S THE CODE:
HDBOpenNoLock("BILL", "BL", "D:\LANSOC\UP\97-98\BILL.DBF") HReadFirst("BILL") WHILE NOT HOut("BILL")
HCopyRecord("BILLFILE","BILL") HAdd("BILLFILE") Entry_No = HRetrieveItem("BILL", 1 ) From_Date = HRetrieveItem("BILL", 5 ) To_Date = HRetrieveItem("BILL", 6 ) BillFile.FromDate = From_Date BillFile.ToDate = To_Date BillFile.EntryNo = Entry_No HModify("BILLFILE") HReadNext("BILL") END HClose("*") |
| |
| |
| | | |
|
| | |
| |
Registered member 175 messages |
|
Posted on December, 26 2024 - 2:24 PM |
Hello
I see your problem, you forgot a search code
In your code, you skipped a line before the modification
You will need to check and add the following program:
Entry_No = HRetrieveItem("BILL", 1 ) From_Date = HRetrieveItem("BILL", 5 ) To_Date = HRetrieveItem("BILL", 6 )
// EDD (12/24) This is where you insert this program HReadSeek(BILLFILE, Identifier, BILLFILE.Identifier) IF HFound(BILLFILE) = True THEN BillFile.FromDate = From_Date BillFile.ToDate = To_Date BillFile.EntryNo = Entry_No IF HModify("BILLFILE") = False THEN Error(ErreurInfo(errComplet)) EndProgram() END END
NB: Each time new information don't forget to add the HReadSeek() program
Best regards Mr.RATSIMANDRESY Niry Aina Eddy |
| |
| |
| | | |
|
| | |
| |
Posted on December, 29 2024 - 2:50 AM |
Niry Aina Eddy RATSIMANDRESY wrote:
Hello
I see your problem, you forgot a search code
In your code, you skipped a line before the modification
You will need to check and add the following program:
Entry_No = HRetrieveItem("BILL", 1 ) From_Date = HRetrieveItem("BILL", 5 ) To_Date = HRetrieveItem("BILL", 6 )
// EDD (12/24) This is where you insert this program HReadSeek(BILLFILE, Identifier, BILLFILE.Identifier) IF HFound(BILLFILE) = True THEN BillFile.FromDate = From_Date BillFile.ToDate = To_Date BillFile.EntryNo = Entry_No IF HModify("BILLFILE") = False THEN Error(ErreurInfo(errComplet)) EndProgram() END END
NB: Each time new information don't forget to add the HReadSeek() program
Best regards Mr.RATSIMANDRESY Niry Aina Eddy
********************
Hi,
I tried the modification suggested by you. It's not working.
Its adding 67 records out of 804 records
Thanks |
| |
| |
| | | |
|
| | |
| |
Posted on January, 09 2025 - 3:59 PM |
Cyril Fernandes wrote:
Niry Aina Eddy RATSIMANDRESY wrote: Hello
I see your problem, you forgot a search code
In your code, you skipped a line before the modification
You will need to check and add the following program:
Entry_No = HRetrieveItem("BILL", 1 ) From_Date = HRetrieveItem("BILL", 5 ) To_Date = HRetrieveItem("BILL", 6 )
// EDD (12/24) This is where you insert this program HReadSeek(BILLFILE, Identifier, BILLFILE.Identifier) IF HFound(BILLFILE) = True THEN BillFile.FromDate = From_Date BillFile.ToDate = To_Date BillFile.EntryNo = Entry_No IF HModify("BILLFILE") = False THEN Error(ErreurInfo(errComplet)) EndProgram() END END
NB: Each time new information don't forget to add the HReadSeek() program
Best regards Mr.RATSIMANDRESY Niry Aina Eddy
******************** Hi, I tried the modification suggested by you. It's not working. Its adding 67 records out of 804 records Thanks
Hi Cyril
We have found that the native access for copying/access code of foxpro/VFP not to be good.
If you are accessing VFP (Visual Foxpro) DBF with CDX index delete the Index and try again with your code. It should work.
Problems like not all records in the DBF accessed when using FOR EACH or displayed in SQL queries just part of the problem.
We resorted to using VFP Oledb (32 bit) to access VFP 9.0 dbf files for reading and writing to dbf files.
https://github.com/VFPX/VFPInstallers/blob/master/OLEDB_Release_Notes.md
//Something to get you started cn_VFPData is Connection
////ds_VFPData is Data Source ////sQueryString is string
// Fill in items in the Connection cn_VFPData..User = "" cn_VFPData..Password = "" cn_VFPData..Server = "localhost" cn_VFPData..Database = "" cn_VFPData..Source = "path and name of dbf file here" cn_VFPData..Provider = "VFPOLEDB.1" cn_VFPData..Access = hOReadWrite cn_VFPData..ExtendedInfo = "" // Open the Connection
bSuccessresult is boolean = False IF NOT HOpenConnection( cn_VFPData ) THEN ToastDisplay(HErrorInfo(),toastLong,vaTop,haCenter,PastelRed) bSuccessresult = False END
sQlstring = "YOUR QUERY HERE"
bReturnvalue1 is boolean = 0
bReturnvalue1 = HExecuteSQLQuery(dsVFPData1, cn_VFPData, hQueryWithoutCorrection, sQlstring) IF bReturnvalue1 = 1 THEN HReadFirst(dsVFPData1) FOR EACH dsVFPData1
//YOUR INITIAL CODE HERE
END
HCancelDeclaration(dsVFPData1) HCloseConnection(cn_VFPData) END |
| |
| |
| | | |
|
| | | | |
| | |
|