ADO RecordSet to DBF

ADO RecordSet to DBF

Postby avista » Thu Jul 10, 2014 2:07 pm

Hi all,

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

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

Re: ADO RecordSet to DBF

Postby Rick Lipkin » Thu Jul 10, 2014 5:50 pm

Avista

Here is the psudo code ..

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

Code: Select all  Expand view  RUN

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
Rick Lipkin
 
Posts: 2666
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: ADO RecordSet to DBF

Postby avista » Thu Jul 10, 2014 10:50 pm

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
avista
 
Posts: 301
Joined: Fri Jun 01, 2007 9:07 am
Location: Macedonia

Re: ADO RecordSet to DBF

Postby nageswaragunupudi » Fri Jul 11, 2014 1:34 am

FWH already provides a ready made function for this.

FW_AdoExportToDBF( oRs, cDbf, lEditStruct )
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10690
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: ADO RecordSet to DBF

Postby avista » Fri Jul 11, 2014 6:39 am

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
avista
 
Posts: 301
Joined: Fri Jun 01, 2007 9:07 am
Location: Macedonia

Re: ADO RecordSet to DBF

Postby nageswaragunupudi » Fri Jul 11, 2014 8:09 am

Understand.

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

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10690
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: ADO RecordSet to DBF

Postby avista » Fri Jul 11, 2014 8:24 am

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

Postby avista » Sun Jul 13, 2014 10:04 pm

Rick, Rao, anyone ?
Any sugestion please ?

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

Re: ADO RecordSet to DBF

Postby cnavarro » Sun Jul 13, 2014 10:25 pm

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
cnavarro
 
Posts: 6552
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: ADO RecordSet to DBF

Postby avista » Mon Jul 14, 2014 10:09 am

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
avista
 
Posts: 301
Joined: Fri Jun 01, 2007 9:07 am
Location: Macedonia

Re: ADO RecordSet to DBF

Postby nageswaragunupudi » Mon Jul 14, 2014 11:27 am

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
nageswaragunupudi
 
Posts: 10690
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: ADO RecordSet to DBF

Postby Antonio Linares » Mon Jul 14, 2014 11:58 am

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: 42203
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: ADO RecordSet to DBF

Postby Antonio Linares » Mon Jul 14, 2014 12:02 pm

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
Antonio Linares
Site Admin
 
Posts: 42203
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: ADO RecordSet to DBF

Postby avista » Mon Jul 14, 2014 12:57 pm

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
avista
 
Posts: 301
Joined: Fri Jun 01, 2007 9:07 am
Location: Macedonia

Re: ADO RecordSet to DBF

Postby nageswaragunupudi » Mon Jul 14, 2014 1:59 pm

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
User avatar
nageswaragunupudi
 
Posts: 10690
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 90 guests