ADO RecordSet to DBF

User avatar
avista
Posts: 301
Joined: Fri Jun 01, 2007 9:07 am
Location: Macedonia

ADO RecordSet to DBF

Post by avista »

Hi all,

I need help how to create DBF file and insert data from ADO Recordset

Best regards,
User avatar
Rick Lipkin
Posts: 2668
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: ADO RecordSet to DBF

Post by Rick Lipkin »

Avista

Here is the psudo code ..

1) Create your .dbf
2) Open your recordset ...

Code: Select all | Expand


oRs:MoveFirst()

Do While .not. oRs:Eof
     
     Select 1
     Append Blank

     a->Field1 := oRs:Fields("Field1"):Value
     a->Field2 := oRs:Fields("Field2"):Value

     oRs:MoveNext()

Enddo

CLose Databases
oRs:Close()
 


Rick Lipkin
User avatar
avista
Posts: 301
Joined: Fri Jun 01, 2007 9:07 am
Location: Macedonia

Re: ADO RecordSet to DBF

Post by avista »

Rick,
Thanks for reply,

1) Create your .dbf


That is my problem ... i cant create .DBF becouse i dont know fields ...
becouse RecordSet is openet berore that and contains data from executed SQL
I want to export data from opened recordset to .dbf file
So i mean to read first the fields from recordset, (filedname, fieldtype, fieldlen, fielddec )
and after that to create .dbf and insert data in .dbf file

Any solution please ?

Best regards,
User avatar
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

Re: ADO RecordSet to DBF

Post by nageswaragunupudi »

FWH already provides a ready made function for this.

FW_AdoExportToDBF( oRs, cDbf, lEditStruct )
Regards

G. N. Rao.
Hyderabad, India
User avatar
avista
Posts: 301
Joined: Fri Jun 01, 2007 9:07 am
Location: Macedonia

Re: ADO RecordSet to DBF

Post by avista »

Rao Thanks for reply

FWH already provides a ready made function for this.

FW_AdoExportToDBF( oRs, cDbf, lEditStruct )


I have seen on this forum that this functuins are includer in version 13.08
I still use 13.04 and not ready in this moment to change version and test apps

viewtopic.php?f=3&t=28708&start=30
Re: DBF to SQL script tool
New postby nageswaragunupudi » Fri Jul 11, 2014 2:37 am

Mr Hakan ONEMLI

FWH Ado functions work for Access, MS Sql, MySql, Oracle and SQLite3.
Regards

G. N. Rao.
Hyderabad, India
nageswaragunupudi


BTW I use Informix and i am not ready now to test it.

Can i find the source of functions:
function FWAdoDelRecord( oRs ) --> lSuccess
function FWAdoFieldType( oRs, n ) --> cType (xbase type)
function FWAdoFieldDec( oRs, n ) --> nDecs (xbase)
function FWAdoFieldSize( oRs, n ) --> nSize (xbase)
function FWAdoLoadRecord( oRs ) --> aRecord
function FWAdoSaveRecord( oRS, aRecord, nRecNo ) --> nil
function FWAdoStruct( oRs ) --> aStruct
function FWAdoFieldStruct( oRs, n/cname/ofield) or (oField)
-> field strut info { cName, cDbtype, nDblen, nDbdec, nAdotype, lReadwrite }
function FW_AdoExportToDBF( oRs, cDbfName, [lEditStruct] ) --> lSuccess

Best regards,
User avatar
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

Re: ADO RecordSet to DBF

Post by nageswaragunupudi »

Understand.

We might consider expanding the coverage to other SQL DBMSs depending on the users' requirements.
Regards

G. N. Rao.
Hyderabad, India
User avatar
avista
Posts: 301
Joined: Fri Jun 01, 2007 9:07 am
Location: Macedonia

Re: ADO RecordSet to DBF

Post by avista »

Thanks Rao

Understand.

We might consider expanding the coverage to other SQL DBMSs depending on the users' requirements.


But please any other solution or
Can i find the source of functions:

function FWAdoDelRecord( oRs ) --> lSuccess
function FWAdoFieldType( oRs, n ) --> cType (xbase type)
function FWAdoFieldDec( oRs, n ) --> nDecs (xbase)
function FWAdoFieldSize( oRs, n ) --> nSize (xbase)
function FWAdoLoadRecord( oRs ) --> aRecord
function FWAdoSaveRecord( oRS, aRecord, nRecNo ) --> nil
function FWAdoStruct( oRs ) --> aStruct
function FWAdoFieldStruct( oRs, n/cname/ofield) or (oField)
-> field strut info { cName, cDbtype, nDblen, nDbdec, nAdotype, lReadwrite }
function FW_AdoExportToDBF( oRs, cDbfName, [lEditStruct] ) --> lSuccess

or sample .PRG for my case
how to detect type, size, dec ...for fields

Best regards,
User avatar
avista
Posts: 301
Joined: Fri Jun 01, 2007 9:07 am
Location: Macedonia

Re: ADO RecordSet to DBF

Post by avista »

Rick, Rao, anyone ?
Any sugestion please ?

REgards,
User avatar
cnavarro
Posts: 6557
Joined: Wed Feb 15, 2012 8:25 pm
Location: España
Been thanked: 3 times

Re: ADO RecordSet to DBF

Post by cnavarro »

Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
avista
Posts: 301
Joined: Fri Jun 01, 2007 9:07 am
Location: Macedonia

Re: ADO RecordSet to DBF

Post by avista »

Navarro thanks for reply

I urgent need the source of function FW_AdoExportToDBF( oRs, cDbfName, [lEditStruct] )
or same similar source sample

Best regards,
User avatar
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

Re: ADO RecordSet to DBF

Post by nageswaragunupudi »

avista wrote:Rao Thanks for reply

FWH already provides a ready made function for this.

FW_AdoExportToDBF( oRs, cDbf, lEditStruct )


I have seen on this forum that this functuins are includer in version 13.08
I still use 13.04 and not ready in this moment to change version and test apps

viewtopic.php?f=3&t=28708&start=30
Re: DBF to SQL script tool
New postby nageswaragunupudi » Fri Jul 11, 2014 2:37 am

Mr Hakan ONEMLI

FWH Ado functions work for Access, MS Sql, MySql, Oracle and SQLite3.
Regards

G. N. Rao.
Hyderabad, India
nageswaragunupudi


BTW I use Informix and i am not ready now to test it.

Can i find the source of functions:
function FWAdoDelRecord( oRs ) --> lSuccess
function FWAdoFieldType( oRs, n ) --> cType (xbase type)
function FWAdoFieldDec( oRs, n ) --> nDecs (xbase)
function FWAdoFieldSize( oRs, n ) --> nSize (xbase)
function FWAdoLoadRecord( oRs ) --> aRecord
function FWAdoSaveRecord( oRS, aRecord, nRecNo ) --> nil
function FWAdoStruct( oRs ) --> aStruct
function FWAdoFieldStruct( oRs, n/cname/ofield) or (oField)
-> field strut info { cName, cDbtype, nDblen, nDbdec, nAdotype, lReadwrite }
function FW_AdoExportToDBF( oRs, cDbfName, [lEditStruct] ) --> lSuccess

Best regards,

They are all functions in the later versions of FWH and the proper way to get the source code of these functions is by upgrading FWH.
FWH being a priced product, we can not share the source code of FWH libraries freely over the forum or otherwise.
But the above functions are not really difficult and one can write by himself.
Regards

G. N. Rao.
Hyderabad, India
User avatar
Antonio Linares
Site Admin
Posts: 42521
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 75 times
Contact:

Re: ADO RecordSet to DBF

Post by Antonio Linares »

Avista,

We can help you with FW_AdoExportToDBF() (I will check it with Rao and I may send you some code by email) but as Rao has clearly explained to you, if you want to use the result of our hard work, you should upgrade your FWH version, thanks for understanding it.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 42521
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 75 times
Contact:

Re: ADO RecordSet to DBF

Post by Antonio Linares »

You can keep using FWH 13.04, upgrade to FWH 14.06, copy the required functions that you need and continue using 13.04.

I am sure that you also ask your customers to get paid by your work :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
avista
Posts: 301
Joined: Fri Jun 01, 2007 9:07 am
Location: Macedonia

Re: ADO RecordSet to DBF

Post by avista »

Thanks to all

In start i only asked how to detect from ado recordset
filedname, fieldtype, fieldlen, fielddec


I use informix

Re: DBF to SQL script tool
New postby nageswaragunupudi » Fri Jul 11, 2014 2:37 am

Mr Hakan ONEMLI

FWH Ado functions work for Access, MS Sql, MySql, Oracle and SQLite3.
Regards

G. N. Rao.
Hyderabad, India
nageswaragunupudi


Understand.

We might consider expanding the coverage to other SQL DBMSs depending on the users' requirements.
Regards

G. N. Rao.
Hyderabad, India


So probably FW_AdoExportToDBF( oRs, cDbfName, [lEditStruct] ) will not help for informix database

But the above functions are not really difficult and one can write by himself.
Regards

G. N. Rao.
Hyderabad, India


If possible i need some help about that how to write function which detect filedname, fieldtype, fieldlen, fielddec from ado recordset and after that i will create .dbf aind insert data from ado recordset.

Antonio,
If you can please send me some start sample source code
sunrised@t-home.mk

Tnanks,

Regards,
User avatar
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

Re: ADO RecordSet to DBF

Post by nageswaragunupudi »

FWH Ado functions work for Access, MS Sql, MySql, Oracle and SQLite3.

That means "all" functions in adofuncs.prg work for these DBMSs. Just a clarification. Many functions work for *all* DBMSs.

For example, for creation of Table on DBMS, we need to know specific datatypes of the DBMS. Also if keywords are used as some field names we need to know how to quote such field names which conflict with keywords. This is different for different DBMSs.

Except create table and sql generation functions, all pure ADO functions work for all DBMSs.
In particular,
Fw_OpenAdoConnection( cConnString )
FW_OpenRecordSet(...)
And all function listed above in this post including FW_AdoExportToDBF(..) work for all DBMSs.
Regards

G. N. Rao.
Hyderabad, India
Post Reply