Page 1 of 1

TOraSmartQuery and triggers (please make simple DbEdit controls demo...)

Posted: Sun 20 Feb 2005 17:42
Hi!

Is there any demo that shows how to use TOraSmartQuery which is based on several DBEdit components on the form?

I'm just missing something ... If some DbEdit fields are assigned to TOraSmartQuery how to:
1) Fill returning values (if user has changed them)...do I need to set some values or SmartQuery is smart enough to set the values by itself?

If is smart then:
2) If some fields are filled by trigger how to assign Insert and update values (i do not need them to fill) ... I allways get the errors that some fields are missing regardless that Oracle will fill them!?

All demos use Grid but in that way I cannot reach the point...how to (and if!!) send/retrieve data !

THX!

Posted: Sun 20 Feb 2005 18:28
What I meant is when some field has DEFAULT value, and I don't send any value (but sometimes I do sent something) how to avoid error in cases when no values are sent (when default values should be aplied...)

THX!

..i foubd it!

Posted: Sun 20 Feb 2005 18:42
Grrrrrrrr!

These options....so nice so hidden...i knew it should be something easy...

:()

Posted: Mon 21 Feb 2005 13:16
by Alex
1) You can use DBEdits with TSmartQuery and TOraTable components same as you use it with BDE TTable.

2) If you specify a default field value in Oracle table, for ex:

Code: Select all

CREATE TABLE SmartDefaultTable(
              Id NUMBER(6) DEFAULT 1,
              Name VARCHAR2(20) )
then if you insert a record without "Id" field value it will have a default value. For ex.

Code: Select all

  INSERT INTO SmartDefaultTable
     (Name)
   VALUES
     ('NameOne')
also you can set TSmartQuery.Options.DefaultValue to True to get the default fields values. (see TOraDataSet.OptionsDS topic in ODAC help)
You can set Inset and Update statements manually, by assigning TSmartQuery.SQLUpdate and TSmartQuery.SQLInsert properties. (see TCustomDADataSet.SQLUpdate and TCustomDADataSet.SQLInsert topics in ODAC help)