> John Griffith wrote in message <3b0fd1a9$1_2@dnews>...
> >Where one has a table that needs to be looked at in a variety of way
> through
> >different SQL queries what is considered "good design practice?" A
> simple
> >example:
> >The data access components will be placed on a Data Module, i.e.
> TQuery.
> >The table is customers. The forms for viewing the data are separate
> forms.
> >The three views to be uses are:
> >1. select * from Customer
> >2. select * from Customer where OrderNo = :OrderNo order by OrderNO
> >3. select * from Customer where Name = :Name order by Name
> >Should the data module have 1, 2, or 3 TQuery components names
> qryCustomer,
> >qryCustomerByOrder and qryCustomerByName (one for each of the above
> >queries)?
> I use as many query components as I need. That way the SQL only needs
> to be specified once at design time and one can take advantage of
> prepared parameters. If the 3 queries you show are real then: I
> strongly advise against one, you should always insist on a Where
> clause; the other two need no Order By since they can only return one
> record as written.
> >Alternatively, should one only have one TQuery component, qryCustomer
> and
> >then dynamically change the SQL statement in each of the viewing
> forms?
> I only do this in the rare case where, based on complex user input,
> there could be *many* variations of a particualr query and thus it is
> easier to generate it than providing separate query components for
> every possible variation.
> >Which is considered proper design where the goal is to isolate the UI
> from
> >the database with 3 tier in mind?
> Whichever way you do this part, it would be done on the server side in
> a 3 tier architecture so it doesn't matter.
> >Next, where is the proper place to put the DataSource component?
> Should it
> >be on the from that has the UI or on the DataModule?
> I consider the datasource to be the GUI's "agent" to connect to data -
> it belongs on the forms. That way there only needs to be a single
> "connection" between the form and a dataset. You only need datasources
> on the datamodule if you are setting up master/detail dataset
> connections.
> --
> Wayne Niddery (WinWright Inc.)
> RADBooks - http://www.logicfundamentals.com/RADBooks/delphibooks.html
> "At the apex of every great tragedy of mankind there stands the figure
> of an incorruptible altruist" - Ayn Rand