Page 1 of 2

ADO RecordSet to DBF

PostPosted: Thu Jul 10, 2014 2:07 pm
by avista
Hi all,

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

Best regards,

Re: ADO RecordSet to DBF

PostPosted: Thu Jul 10, 2014 5:50 pm
by Rick Lipkin
Avista

Here is the psudo code ..

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

Code: Select all  Expand view

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

Re: ADO RecordSet to DBF

PostPosted: Thu Jul 10, 2014 10:50 pm
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,

Re: ADO RecordSet to DBF

PostPosted: Fri Jul 11, 2014 1:34 am
by nageswaragunupudi
FWH already provides a ready made function for this.

FW_AdoExportToDBF( oRs, cDbf, lEditStruct )

Re: ADO RecordSet to DBF

PostPosted: Fri Jul 11, 2014 6:39 am
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,

Re: ADO RecordSet to DBF

PostPosted: Fri Jul 11, 2014 8:09 am
by nageswaragunupudi
Understand.

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

Re: ADO RecordSet to DBF

PostPosted: Fri Jul 11, 2014 8:24 am
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,

Re: ADO RecordSet to DBF

PostPosted: Sun Jul 13, 2014 10:04 pm
by avista
Rick, Rao, anyone ?
Any sugestion please ?

REgards,

Re: ADO RecordSet to DBF

PostPosted: Sun Jul 13, 2014 10:25 pm
by cnavarro

Re: ADO RecordSet to DBF

PostPosted: Mon Jul 14, 2014 10:09 am
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,

Re: ADO RecordSet to DBF

PostPosted: Mon Jul 14, 2014 11:27 am
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.

Re: ADO RecordSet to DBF

PostPosted: Mon Jul 14, 2014 11:58 am
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.

Re: ADO RecordSet to DBF

PostPosted: Mon Jul 14, 2014 12:02 pm
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 :-)

Re: ADO RecordSet to DBF

PostPosted: Mon Jul 14, 2014 12:57 pm
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,

Re: ADO RecordSet to DBF

PostPosted: Mon Jul 14, 2014 1:59 pm
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.