revDataFromQuery - list of columns

Jan Schenkel janschenkel at yahoo.com
Tue Jul 1 04:34:00 EDT 2003


--- Jez <jbradshaw at blueyonder.co.uk> wrote:
> I'm accessing an Access database via ODBC. How come
> I can do this:
> put revDataFromQuery(,,db_id,"select * from pl where
> pl_team_id =
> :1","tm_id") into field "Players"
> 
> but I cant replace the * with a list of columns.
> When I do this:
> 
> put revDataFromQuery(,,db_id,"select
> pl_id,pl_name,pl_desc from pl where
> pl_team_id = :1","tm_id") into field "Players"
> 
> I get an error that it;s expecting a 2nd parameter.
> If you cant do this, is
> there any way you can plug in parameters to a
> predefined query/record-set in
> Database Query Builder?
> 

Hi Jez,

Odd behaviour ; but then again I never use the ':n'
constructs ; have you tried the following ?
  put merge("SELECT pl_id,pl_name,pl_desc FROM pl
WHERE pl_team_id = [[tm_id]]") into tSQLQuery
  put revDataFromQuery(,,db_id,tSQLQuery)

As for using the Database Query Builder :
- make an extra query with the connection details ;
let's name it "pl_tm_id_query"
- now you can change the query and refresh any fields
connected to that query by scripting
  put merge("SELECT pl_id,pl_name,pl_desc FROM pl
WHERE pl_team_id = [[tm_id]]") into tSQLQuery
  revSetSQLOfQuery "pl_tm_id_query", tSQLQuery

Hope this helped,

Jan Schenkel.

=====
"As we grow older, we grow both wiser and more foolish at the same time."  (La Rochefoucauld)

__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com



More information about the use-livecode mailing list