Link to home
Start Free TrialLog in
Avatar of posconsultant
posconsultant

asked on

Join, UpdateSQL, and params with unknown fields

Hi,
  I posted a similar question previously here:  Using Delphi 4, Woll2Woll components, Oracle 8 db.  I want to be able to edit a query with a join.  I understand that I can do this with a TUpdateSQL, one for each table in the query.  The problem is it seems I have to reference field names and params in TUpdateSQL InsertSQL, deleteSQL, modifySQL statements, but I want the ability to add fields to the db in the future, so referencing fields at design time will not work.  Any help with examples of syntax greatly appreciated.
Avatar of mrissmann
mrissmann

This is the only way.

You are able to keep adding field anytime you want.  Instead of modifing the fields in the InsertSQL... just double click on the TUpdateSQL component and a wizard will appear.  There are two columns, one for the primary key and the other is for the fields that you want posted.  Select the field here (cannot be any joined fields).  When finished click on generate SQL.  Anytime that you add a field just come back to this wizard(if you want the new field to be posted) and add it to your selection and generate the SQL statement again.  I never manually modify the InsertSQL...

Any questions let me know.  We figured out the art of cachedupdates and TUpdateSQL the hardway.

Mark Rissmann
Avatar of posconsultant

ASKER

Thanks for the answer.  I don't like it :-), so I'm going to keep this open.  I want to be able to do this without having to alter the source code.  
Without cachedupdates turned on you can not edit a query with joins.  Maybe tClientDataset or somekind of asp.  Enjoy reinventing your own wheel.  I have been doing this for 4 years.
ASKER CERTIFIED SOLUTION
Avatar of DValery
DValery

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks.  I was pretty sure this could be done by obtaining db metadata and dynamically generating SQL statements.