Subject |
Re: invalid subscript reference |
From |
Maurizio S. <mau@mau.it> |
Date |
Tue, 22 Sep 2020 13:36:11 +0200 |
Newsgroups |
dbase.getting-started |
avoid qADO.sql +=
I had similar problem in the past and maybe concatenated string is
IO = 'SELECT count(distinct cast(eTimestamp as date)) as Days '
IO+= 'from energydata where siteNum =:nCGIsiteNum and eTimestamp between
:dStart and :dEnd'
qADO.sql := IO
IO = "SELECT count(distinct cast(eTimestamp as date)) as Days "
IO += "from energydata where siteNum = :nCGIsiteNum2 and eTimestamp
between "
IO += ":dStart2 and :dEnd2 order by Days"
qADO2.sql := IO
tks
Maurizio
Il 22/09/20 10:49, Gaetano ha scritto:
>
> HI All,
>
> I am getting an invalid subscript error that I can't troubleshoot...
>
> Here is the code, the first ADO query works fine, the second one gives
> me an invalid subscript error on the second param, while it is exactly
> the same as the previous one, I put in a msgbox to verify the values and
> they are correct.
>
> Is there something obvious I am overlooking?
>
> -------first query
> // ADO query to count days in data set
> qADO = new adoquery()
> qADO.database = d
> qADO.sql = 'SELECT count(distinct cast(eTimestamp as date)) as Days '
> qADO.sql += 'from energydata where siteNum =:nCGIsiteNum and
> eTimestamp between :dStart and :dEnd'
> qADO.params["nCGIsiteNum"].value = oCGI["CGIsiteNum"]
> qADO.params["dStart"].value = oCGI["CGIdStart"]
> qADO.params["dEnd"].value = oCGI["CGIdEnd"]
> qADO.active = true
>
> _app.cQTYDAYS := qADO.rowset.fields["days"].value
> msgbox("app_cQTYDAYS= "+_app.cQTYDAYS)
> nTotDays=qADO.rowset.fields["days"].value
> qADO.active=false
> release qADO
>
> //msgbox("CGIs=
> "+oCGI["CGIsiteNum"]+"/"+oCGI["CGIdStart"]+"/"+oCGI["CGIdEnd"])
>
> ----------second query
> initenv()
> //inactivate query, change SQL and count missing days in data set
> //qADO.active = false
> qADO2 = new adoquery()
> qADO2.database = d
> qADO2.sql = "SELECT count(distinct cast(eTimestamp as date)) as
> Days "
> qADO2.sql += "from energydata where siteNum = :nCGIsiteNum2 and
> eTimestamp between "
> qADO2.sql += ":dStart2 and :dEnd2 order by Days"
> qADO2.params["nCGIsiteNum2"] = oCGI["CGIsiteNum"]
> qADO2.params["dStart2"] = oCGI["CGIdStart"]
> qADO2.params["dEnd2"] = oCGI["CGIdEnd"]
> qADO2.active = true
|
|