Subject Re[2]: [IBO] View, filter or ... ?
Author Cristian Ivan
Hello Helen,

Saturday, March 03, 2001, 9:54:16 PM, you wrote:

HB> select <fieldlist> from aTable
HB> where month = :inmonth and year = :inyear

HB> Then, when the user selects the month and year,

HB> MyQuery.ParamByName('inMonth').AsInteger := <the selected month>;
HB> MyQuery.ParamByName('inYear').AsInteger := <the selected year>;
Thanks..i've never used ParamByName before and it seems quite useful.
Too bad that not for the actual situation I've got, but can be used
somewhere else :) That's because right here
I'm programatically building the query (like q.sql.text='select * from
table where (somecondition)') and instead of using parambyname I'd
rather use something like q.sql.text=format('select * from table where
(someconditions) and (month=%d) and (year=%d)',[month,year]). This is
exactly what I was trying to avoid but it seems there's no easy way
around it... This way, I only need to pay attention that all queries
have these "where" clauses :)

BTW, I've got some 20 forms and I wonder what's the best solution to
use queries: put one query in a DataModule (which I'm not using right
now; I've put there only the connection,transaction... and the queries
in each form) or put in
every form a different query. What's the impact in
performance/resources ?

>>Note: the problem with this is that only one user could use the
>>database at one time...or more users using only the selected month and
>>year. In fact this is way I'm trying to find an alternative :)
HB> Why ?
The problem was that creating a view as "select ... where month=3 and
year=2001" whould force all users to use only that month,year or
dropping the view and creating another one (which can't be done if the
view is already in use by somebody else, of course).

Best regards,
Cristian mailto:cris@...