Subject Re: DMD designer parameter syntax
From Gaetano <gaetanodd@hotmail.com>
Date Sun, 4 Oct 2020 10:29:06 +1000
Newsgroups dbase.getting-started


The odd designer-generated coding seems related to the fact that I was
splitting the SQL code on separate lines with semicolons. The following
code is unaltered by the designer and works:

this.OADOQ = new ADOQUERY(this)
    with (this.OADOQ)
       left = 206.0
       top = 77.0
       width = 122.0
       height = 88.0
       database = form.so2ado1
       connected = true
                cSQL = "select siteNum, eTimestamp, egen, econs, extract(month from
eTimestamp) as mm, "
                cSQL+= "extract(hour from eTimestamp) as Hours from energydata where
siteNum = :nSite and "
                cSQL+= "extract(month from eTimestamp) between :nPstart and :nPend and "
                cSQL+= "extract(hour from eTimestamp) between :hStart and :hEnd"
                sql = cSQL
                params["nSite"].value = 1000000
                params["nPstart"].value = 1
                params["nPend"].value = 12
                params["hStart"].value = 7
                params["hEnd"].value = 18
                active = true
    endwith

Cheers,
Gaetano.

On 04/10/2020 06:22, Ken Mayer wrote:
> On 10/3/2020 1:14 PM, Gaetano wrote:
>>
>> Hi all,
>>
>> I was creating a DMD where the SQL statement of the ADO query includes
>> calculated fields (e.g. [extract(month from eTimestamp) as mm]) and
>> params.
>>
>> I had entered the params as
>>
>> params["nSite"].value = 1000000
>> ...etc.
>>
>> but the designer converted it to the following syntax.
>>
>> Any idea why params was converted to parameters? and what is the
>> purpose or requirement of the "signed" property of a parameter please?
>> I found something buried in the Help file under Classes_ADOParameter
>> in Search, but it just shows a default value and no description.
>
> The designers don't handle custom code well, and the reason for params
> being changed is most likely because of some internal code that streams
> out the program.
>
> Suggest you use the onOpen event handler (or even the canOpen) to set
> the parameter the way you need it to be set.
>
> Ken
>
>