| Subject |
invalid subscript reference |
| From |
Gaetano <gaetanodd@hotmail.com> |
| Date |
Tue, 22 Sep 2020 18:49:36 +1000 |
| Newsgroups |
dbase.getting-started |
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
|
|