FW_DbfSqlQuery does not work

FW_DbfSqlQuery does not work

Postby damianodec » Fri Jun 19, 2020 3:08 pm

Hi,
I'm trying this code:
Code: Select all  Expand view
#include "fivewin.ch"
#include "xbrowse.ch"
#include "hbcompat.ch"

function Main()

   local nAvgAge, aData, cSql
   local cFolder  := "c:\fwh\samples\"

   TEXT INTO cSql
   SELECT A.STATE AS CODE,S.NAME AS STATENAME,A.NUM,A.AVGAGE,A.SALARY FROM
   (  SELECT STATE, COUNT(*) AS NUM, AVG(AGE) AS AVGAGE, SUM(SALARY) AS SALARY
      FROM CUSTOMER GROUP BY STATE ) A
   LEFT OUTER JOIN STATES S ON A.STATE = S.CODE
   ENDTEXT

   aData    := FW_DbfSqlQuery( cFolder, cSql )
   nAvgAge  := FW_DbfSqlQuery( cFolder, "
SELECT AVG(AGE) FROM CUSTOMER" )
   // nAvgAge := nAvgAge[1,1] // for FWH13.06 and earlier

   XBROWSER aData TITLE "
Statewise Employees" ;
      SETUP (  oBrw:cHeaders := { "
Code", "StateName", "NumEmp", "AvgAge", "TotalSalary" }, ;
               oBrw:cEditPictures := { nil, nil, "
999", "99.99", "99,999,999" }, ;
               oBrw:lFooter  := .t., ;
               oBrw:NumEmp:nFooterType := oBrw:TotalSalary:nFooterType := AGGR_SUM, ;
               oBrw:AvgAge:bFooter := { || nAvgAge }, ;
               oBrw:Code:cFooter := cValToChar( Len( aData ) ), ;
               oBrw:MakeTotals() )

return nil


but does not works.

I checked inside dbffunc2.prg (FW_DbfSqlQuery Function) and at this row crashed
Code: Select all  Expand view

...
oCn := FW_OpenAdoConnection( cFolder)
...
 


any suggestion ?

Thank you.
FiveWin for xHarbour 17.09 - Sep. 2017 - Embarcadero C++ 7.00 for Win32
FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)
Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
User avatar
damianodec
 
Posts: 419
Joined: Wed Jun 06, 2007 2:58 pm
Location: Italia

Re: FW_DbfSqlQuery does not work

Postby nageswaragunupudi » Mon Jun 22, 2020 6:05 pm

This sample code is working for me as expected, include nAvgSalary.
Please check if the folder "c:\fwh\samples\" really exists on your computer.
Note: This may not work with 64-bit applications.
Regards

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 83 guests