Recent

Author Topic: [SOLVED] Firebird 'Integer' field with NULL value  (Read 2299 times)

iru

  • Full Member
  • ***
  • Posts: 224
[SOLVED] Firebird 'Integer' field with NULL value
« on: March 08, 2015, 11:43:11 pm »
Gentlefolk,

I have a FireBird database table with 'integer' type field with a 'NULL' value.

When I load the table into a SQLQuery-DBGrid combination the field/cell is displayed as an 'empty' cell.
This is what I want as the user simply types data into an 'empty' cell in the DBGrid.

If I wish to delete data in the table field, that is reset the field in the database so that the DBGrid cell displays an 'empty' cell. how do I do it?
How do I write a 'NULL'  into the table field?

The following code results in a 0 (zero) in the table field.

var
  vVariant : Variant;

begin
  InQ.Edit;
  vVariant := NULL;
  try
    Variants.NullStrictConvert := False;
     InQ.FieldByName('MemReg').AsInteger := vVariant;
  finally
    Variants.NullStrictConvert := True;
  end;
end;

An help appreciated, Ian



« Last Edit: March 09, 2015, 01:46:35 am by iru »

GetMem

  • Hero Member
  • *****
  • Posts: 3501
Re: Firebird 'Integer' field with NULL value
« Reply #1 on: March 09, 2015, 12:08:12 am »
Hi Iru,

Try this:
InQ.FieldValues['MemReg'] := null;

regards,
GetMem

iru

  • Full Member
  • ***
  • Posts: 224
Re: [SOLVED] Firebird 'Integer' field with NULL value
« Reply #2 on: March 09, 2015, 01:48:36 am »
Thank you GetMem, fixed things nicely.

Ian