Board index » delphi » Problem with not null and default value..

Problem with not null and default value..

hi people,

I am using Delphi 3 with BDE 5.10, this is my problem

I have a MSSQL 7 table with some fields one of them is 'Estatus' on
MSSQL 7
it do not accept null value and has a default value of  '1'.

When I insert a record in my Delphi App and  when I post it I get the
error
" Estatus field must have a value", I do not understand why if I set a
default value
on it. Otherwise if I set the value via code I get no error or when I
set Allow null to false, I can post the record.

Thanks in advance

Roberto Martinez

 

Re:Problem with not null and default value..


I am not sure how the BDE will handle it, but in SQL7 with the query
analiezer you can pass  in the default value within your SQL,
(Insert into  TableA (Serial, Type) Values ('1', default)

HTH,

Morgan

Quote
Roberto Martinez <rmart...@hmo.megared.net.mx> wrote in message

news:3821EC49.EFBFB45E@hmo.megared.net.mx...
Quote
> hi people,

> I am using Delphi 3 with BDE 5.10, this is my problem

> I have a MSSQL 7 table with some fields one of them is 'Estatus' on
> MSSQL 7
> it do not accept null value and has a default value of  '1'.

> When I insert a record in my Delphi App and  when I post it I get the
> error
> " Estatus field must have a value", I do not understand why if I set a
> default value
> on it. Otherwise if I set the value via code I get no error or when I
> set Allow null to false, I can post the record.

> Thanks in advance

> Roberto Martinez

Re:Problem with not null and default value..


Roberto,

the field test is done on the TDataset level so the only way to get by this
is to set .Required:=False for this field, or to supply a default value in
the TField.DefaultExpression property.

Sincerely

Thomas Werner
CS Support, supp...@component-store.com
Component Store Ltd., http://component-store.com

Roberto Martinez <rmart...@hmo.megared.net.mx> skrev i
diskussionsgruppsmeddelandet:3821EC49.EFBFB...@hmo.megared.net.mx...

Quote
> hi people,

> I am using Delphi 3 with BDE 5.10, this is my problem

> I have a MSSQL 7 table with some fields one of them is 'Estatus' on
> MSSQL 7
> it do not accept null value and has a default value of  '1'.

> When I insert a record in my Delphi App and  when I post it I get the
> error
> " Estatus field must have a value", I do not understand why if I set a
> default value
> on it. Otherwise if I set the value via code I get no error or when I
> set Allow null to false, I can post the record.

> Thanks in advance

> Roberto Martinez

Other Threads