Subject | [IBO] Re: Default values not defaulting (newbie) |
---|---|
Author | bhatakeyama |
Post date | 2002-04-11T06:08:07Z |
--- In IBObjects@y..., "Helen Borrie (TeamIBO)" <helebor@t...> wrote:
but didn't see any reference to ColumnAttributes or InternalDataset.
either send a NULL or a value I set in DefaultValues. Doesn't this
defeat the ability to have the server set the default values?
The field that I am having problems with is defined as:
SMALLINT DEFAULT 0 NOT NULL
> At 07:55 PM 10-04-02 +0000, bhata wrote:guess
> >With BCB 'ColumnAttributes' is a StringList and the contents
> >is empty. I'm guessing you're describing Delphi IDE.
>
> He is describing the Fields Editor for the native IBO datasets. I
> you are using IBOQuery and an old release of IBO, right? If so, youcan
> access the ColumnAttributes property through the InternalDataset.Pick up
> the TI sheet "Working with Datasets" to see what you need to do toset
> these in code.I am using IBOQuery with the latest IBO4Gc. I looked at the TI sheet
but didn't see any reference to ColumnAttributes or InternalDataset.
> However, the property you want is DefaultValues, since in this caseI don't
> think you want to override the NOT NULL attribute of this column.updates)
>
> Something you need to understand about database-defined default
> values: they are applied only if both of the following are true:
> 1) a new record is being inserted (default doesn't work with
> 2) the column to be defaulted is not present in the insertstatement.
>insert
> If you are using the standard Insert method of the dataset, then the
> statement WILL include the column. Even if the application passesNULL
> (which it will, if the user or the application does not pass avalue) the
> default will not kick in because the database engine *receives* NULLfor
> the column. Therefore, if you want a default value, then assignyour
> default value to the column in DefaultValues, viz.If I understand you correctly, if I use Insert() TIBOQuery will
> MyColumn=someconstantvalue
either send a NULL or a value I set in DefaultValues. Doesn't this
defeat the ability to have the server set the default values?
The field that I am having problems with is defined as:
SMALLINT DEFAULT 0 NOT NULL
>on
> Now, to deal with the other problem, which is the REQUIRED attribute
> your primary key. You don't say whether you are using a generatorfor this
> but, if so, simply set the GeneratorLinks property:RecNum=MyGenerator
>ground...
> If you are not using a generator, you are probably on dangerous
>
>
> regards,
> Helen Borrie (TeamIBO Support)
>
> ** Please don't email your support questions privately **
> Ask on the list and everyone benefits
> Don't forget the IB Objects online FAQ - link from any page at
> www.ibobjects.com