Hi all,

        I'm using this code to execute a SQL command against PostgreSQL
8.2.5, and it's working OK.

TEXT TO lcStr TEXTMERGE NOSHOW
        SELECT 
                s.id,
                s.data,
                s.scadenza,
                s.personale,
                s.prestaz,
                s.cli_fk,
                c.ragsoc,
                pra.nome        AS nomeprat,
                pro1.codice AS ref,
                pro1.nome       AS nomeref,
                pro2.codice AS prof,
                pro2.nome       AS nomeprof,
                pro3.codice AS ref2,
                pro3.nome       AS nomeref2,
                pro4.codice AS prof2,
                pro4.nome       AS nomeprof2
        FROM scadenze s
                JOIN clienti c    ON s.cli_fk  = c.id
                JOIN pratiche pra ON s.pra_fk  = pra.id
                JOIN profess pro1 ON s.ref_fk  = pro1.id
                JOIN profess pro2 ON s.pro_fk  = pro2.id
                JOIN profess pro3 ON s.ref2_fk = pro3.id
                JOIN profess pro4 ON s.pro2_fk = pro4.id
        WHERE scadenza BETWEEN << oApp.DateVFP2PG(Thisform.Dal) >> AND <<
oApp.DateVFP2PG(Thisform.Al) >>
        ORDER BY scadenza
ENDTEXT


        Now I'd like to break it in pieces, as I need to change the query a
bit, based on some conditions. I tried this:

-----
lcSelect = "SELECT " + ;
                        "s.id, " + ;
                        "s.data, " + ;
                        "s.scadenza, " + ;
                        "s.personale, " + ;
                        "s.prestaz, " + ;
                        "s.cli_fk, " + ;
                        "c.ragsoc, " + ;
                        "pra.nome AS nomeprat, " + ;
                        "pro1.codice AS ref, " + ;
                        "pro1.nome      AS nomeref, " + ;
                        "pro2.codice AS prof, " + ;
                        "pro2.nome      AS nomeprof, " + ;
                        "pro3.codice AS ref2, " + ;
                        "pro3.nome      AS nomeref2, " + ;
                        "pro4.codice AS prof2, " + ;
                        "pro4.nome      AS nomeprof2 "

lcFrom = "FROM scadenze s " + ;
                        "JOIN clienti c ON s.cli_fk  = c.id " + ;
                        "JOIN pratiche pra ON s.pra_fk  = pra.id " + ;
                        "JOIN profess pro1 ON s.ref_fk  = pro1.id " + ;
                        "JOIN profess pro2 ON s.pro_fk  = pro2.id " + ;
                        "JOIN profess pro3 ON s.ref2_fk = pro3.id " + ;
                        "JOIN profess pro4 ON s.pro2_fk = pro4.id "

lcWhere = "WHERE scadenza BETWEEN << oApp.DateVFP2PG(Thisform.Dal) >> AND <<
oApp.DateVFP2PG(Thisform.Al) >> "

lcOrder = "ORDER BY scadenza"

lcStr = lcSelect + lcFrom + lcWhere + lcOrder
-----

But I get a PG/ODBC error: "Connectivity error: ERROR: missing FROM-clause
entry for table "thisform". I've tried to substitute <<>> with (), even
removed them entirely, but the error is still there.

What am I missing?

TIA

Iames

 
 
 --
 Email.it, the professional e-mail, gratis per te: http://www.email.it/f
 
 Sponsor:
 In REGALO 'All the Good Thing' di NELLY FURTADO
 Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=6616&d=18-12


_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to