Subject [IBO] Re: Changing the Not Null Constraint at run time
Author shahrambesharati
Thank you for your response.
I am pretty new to IBO and apologise if I am asking silly questions.
I still can't change the attributes of a column in my codes.
I have the following statement in my code:
...
IB_DSQL1.SQL.Text := 'CREATE TABLE COUNTRY(COUNTRYNAME VARCHAR(10)
NOT NULL , CURRENCY VARCHAR(10))';
...

I like to add the Not Null Constraint to the Currency Column and have
done the following:
...
IB_Connection1.ColumnAttributes.LinkValues['COUNTRY.CURRENCY']:=
IB_REQUIRED;
IB_DSQL1.Prepare;
IB_DSQL1.Prepared:= True;
...

I have also tried, Unprepare, OnPrepareSQL in the code without any
luck.

Thank you in advance.

Shah

--- In IBObjects@y..., "Jason Wharton" <jwharton@i...> wrote:
> Keep in mind, when doing ColumnAttributes changes, the affected
> datasets/statements must be prepared fresh for them to be read.
> ColumnAttributes are only taken into consideration at prepare time.
>
> HTH,
> Jason Wharton
> CPS - Mesa AZ
> http://www.ibobjects.com
>
>
> ----- Original Message -----
> From: "shahrambesharati" <besharati@h...>
> To: <IBObjects@y...>
> Sent: Thursday, May 30, 2002 5:08 PM
> Subject: [IBO] Re: Changing the Not Null Constraint at run time
>
>
> > Thank you for your response.
> >
> > As suggested, I used the REQUIRED/NOREQUIRED ColumnAttributes of
the
> > IBConnection
> > in order to control the Nullability Constraint.
> >
> > I have tried the following codes(one at the time) to add Not Null
> > constraint to a column called Currency but it does not change the
> > attribute of the column.
> >
> > IB_Connection1.ColumnAttributes.Add
('COUNTRY.CURRENCY=REQUIRED=TRUE');
> > IB_Connection1.ColumnAttributes.Add('CURRENCY=REQUIRED');
> > IB_Connection1.ColumnAttributes.LinkValues['CURRENCY']:=
IB_REQUIRED;
> >
> > I appreciate you assistance.
> >
> > Shahram
> >
> >
> > --- In IBObjects@y..., "Helen Borrie (TeamIBO)" <helebor@t...>
wrote:
> > > At 06:08 AM 30-05-02 +0000, you wrote:
> > > >Hello,
> > > >
> > > >I like to change the ?Not Null? constraint for a field at run
time
> > > >using the SchemaCache.Requried but have been unsuccessful.
> > > >
> > > >Is it possible to Add/Delete the FieldName and TableName to
> > > >SchemaCache.Requried or is this object only used to display
Fields
> > > >that have the ?Not Null? Constraint.
> > > >
> > > >I appreciate you help.
> > >
> > > Don't attempt to meddle with the Schema Cache - it is not
intended
> > for this.
> > >
> > > Set the REQUIRED ColumnAttribute of the column to False, at
dataset
> > level
> > > or, if you need it multiple places, at the connection level.
> > >
> > > For more information, see the help text and also the "Working
> > with.." TI
> > > sheets on the TechInfo page.
> > >
> > > 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
> >