Board index » delphi » access 97 - stringfield property: empty strings allowed

access 97 - stringfield property: empty strings allowed

In an delphi-program I've created an access-97 table with some
string-fields in it.

When I try to post some data all is ok, when the strings are not empty,
but if so, my set of data will not be saved.

In Access I looked why, and I found, that there is an 'empty strings
allowed' - property for string-fields and in
my delphi-added fields this property is set to false. Now I know, why my
datas are not stored, but what can I do,
if some empty strings are correct, or in other words: how can I set this
property to true?

Thanks in advance

Jana

 

Re:access 97 - stringfield property: empty strings allowed


I also had that problem. I solved it that way:

if AnyString = '' then Fields[x].AsVariant := null
else Fields[x].AsString := AnyString;

Where AnyString is of type string and x represents the order number of the
field (starting with 0).
If you use TField-objects directly, you can exchange Fields[x] with the name
of the TField-object.

Hope that serves your needs.
Christian Wallner

Jana Borchart schrieb in Nachricht <36AC65B5.6B2FD...@mb2.tu-Chemnitz.de>...

Quote
>In an delphi-program I've created an access-97 table with some
>string-fields in it.

>When I try to post some data all is ok, when the strings are not empty,
>but if so, my set of data will not be saved.

>In Access I looked why, and I found, that there is an 'empty strings
>allowed' - property for string-fields and in
>my delphi-added fields this property is set to false. Now I know, why my
>datas are not stored, but what can I do,
>if some empty strings are correct, or in other words: how can I set this
>property to true?

>Thanks in advance

>Jana

Re:access 97 - stringfield property: empty strings allowed


change the Allow Zero Length Property of string fields to true. I hope this
helps.

Burak

Other Threads