Hi,
I am running a query as follows: (Accyrid: char(10), Accfrom: Date, Accto: Date)
Code: Select all
function get_data()
local aRec := {}, i
aRec := sql(dbo, "select Accyrid, Accfrom, Accto from Accyr order by Accfrom")
frmAccyr.grdAccyr.DeleteAllItems()
for i := 1 to len(aRec)
//msgbox(valtype(aRec[i, 2])) // shows valtype of aRec[i, 2] is C
frmAccyr.grdAccyr.additem({aRec[i, 1], dtoc(aRec[i, 2]), dtoc(aRec[i, 3])}) // giving error this line
next
form_resize()
return nil
, where sql() function is as follows (written by Rahinagiri):
Code: Select all
function sql(dbo1,qstr)
local i, j
local table := nil
local currow := nil
local tablearr := {}
local rowarr := {}
local curdateformat := set(_SET_DATEFORMAT)
set date ansi
table := dbo1:query(qstr)
set(_SET_DATEFORMAT,curdateformat)
if table:neterr()
msgstop(table:error())
table:destroy()
return tablearr
else
if table:lastrec() > 0
asize(tablearr,0)
for i := 1 to table:lastrec()
asize(rowarr,0)
currow := table:getrow(i)
for j := 1 to table:fcount()
aadd(rowarr,currow:fieldget(j))
next j
aadd(tablearr,aclone(rowarr))
next i
endif
table:destroy()
return tablearr
endif
return tablearr
Now, the array returned by the query contains blank strings only, in place of date fields!!!
So, how can I get data for date fields?
TIA.
With best regards.
Sudip