Board index » delphi » zero-length strings

zero-length strings

Hi,

I try to get application originaly written on Oracle database to work
correctly on Access 2000.
One of the problems is that when I delete the value in a string field and
try to apply the changes I get the message Field 'Field_Name' cannot be a
zero-length string. I know there is a possibility to allow fields to store a
zero-length strings but when I delete field value I want to store NULL
value, not zero-length string.
Any suggestions?
Thanks in advance!

Best wishes, Anabella

 

Re:zero-length strings


I call the the following procedure OnBeforePost:

procedure TData.BeforePost(DataSet: TDataset);
var
  i: integer;
begin
  with Dataset do
  for i := 0 to Fields.Count-1 do
  if (Fields[i].DataType in [ftString, ftMemo, ftFixedChar, ftWideString])
     and (Fields[i].AsString = '')
  then Fields[i].Value := null;
end;

Hope this helps
Juan

Quote
"Anabella Giseour" <gisanabe...@yahoo.com> wrote in message

news:3d3318af_2@dnews...
Quote
> Hi,

> I try to get application originaly written on Oracle database to work
> correctly on Access 2000.
> One of the problems is that when I delete the value in a string field and
> try to apply the changes I get the message Field 'Field_Name' cannot be a
> zero-length string. I know there is a possibility to allow fields to store
a
> zero-length strings but when I delete field value I want to store NULL
> value, not zero-length string.
> Any suggestions?
> Thanks in advance!

> Best wishes, Anabella

Other Threads