Watch, Follow, &
Connect with Us

Please visit our new home
community.embarcadero.com.


Welcome, Guest
Guest Settings
Help

Thread: TIBDataset.FieldByName(Fieldname).IsNull



Permlink Replies: 4 - Last Post: Mar 28, 2017 9:14 AM Last Post By: Jeff Overcash (... Threads: [ Previous | Next ]
Adalberto Baldini

Posts: 131
Registered: 1/31/12
TIBDataset.FieldByName(Fieldname).IsNull
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 27, 2017 9:08 AM
Delphi XE5 I test a Blob Field in TIBDataset with :

I try to empty field

frm_Main.IBDts_Fields.FieldByName('FOTO').Assign(nil);
frm_Main.IBDts_Fields.FieldByName('FOTO').Clear;

and then test with

if (Frm_Main.wDs_Fields.Dataset.FieldByName('FOTO').IsNull) then ........

but it always return False

What is wrong ?

Adalberto Baldini
georges ribeiro

Posts: 1
Registered: 5/15/05
Re: TIBDataset.FieldByName(Fieldname).IsNull
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 27, 2017 9:17 AM   in response to: Adalberto Baldini in response to: Adalberto Baldini
Adalberto Baldini wrote:
Delphi XE5 I test a Blob Field in TIBDataset with :

I try to empty field

frm_Main.IBDts_Fields.FieldByName('FOTO').Assign(nil);
frm_Main.IBDts_Fields.FieldByName('FOTO').Clear;

and then test with

if (Frm_Main.wDs_Fields.Dataset.FieldByName('FOTO').IsNull) then ........

but it always return False

What is wrong ?

Adalberto Baldini

hello,

You should try :

frm_Main.IBDts_Fields.FieldValues['FOTO'] := null;

if frm_Main.IBDts_Fields.FieldValues['FOTO'] = null then ...
Jeff Overcash (...

Posts: 1,416
Registered: 9/23/99
Re: TIBDataset.FieldByName(Fieldname).IsNull
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 27, 2017 10:46 AM   in response to: Adalberto Baldini in response to: Adalberto Baldini
Adalberto Baldini wrote:
Delphi XE5 I test a Blob Field in TIBDataset with :

I try to empty field

frm_Main.IBDts_Fields.FieldByName('FOTO').Assign(nil);
frm_Main.IBDts_Fields.FieldByName('FOTO').Clear;

Assigning nil (a pointer not NULL) and clear are effectively the same (The
assign(nil) in the end calls clear). Clear creates a writable blobstream and
frees it. This creates a 0 length blob so not NULL. This is sorta like the
difference between NULL and the empty string for VarChars. NULL is a state not
a value so and empty blob makes sense in that context.

Just assign NULL like usual

frm_Main.IBDts_Fields.FieldByName('FOTO').Value := null;


and then test with

if (Frm_Main.wDs_Fields.Dataset.FieldByName('FOTO').IsNull) then ........

but it always return False

What is wrong ?

Adalberto Baldini

--
Jeff Overcash (TeamB)
(Please do not email me directly unless asked. Thank You)
Learning is finding out what you already know. Doing is demonstrating that you
know it. Teaching is reminding others that they know it as well as you. We are
all leaners, doers, teachers. (R Bach)

Adalberto Baldini

Posts: 131
Registered: 1/31/12
Re: TIBDataset.FieldByName(Fieldname).IsNull
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 27, 2017 10:37 PM   in response to: Jeff Overcash (... in response to: Jeff Overcash (...
Just assign NULL like usual

frm_Main.IBDts_Fields.FieldByName('FOTO').Value := null;

Jeff Overcash (TeamB)

I get a compilation error :

[dcc32 Error] ImageBox_frm.pas(82): E2003 Undeclared identifier: 'null'

but all works with

frm_Main.IBDts_Fields.FieldByName('FOTO').Value := '';

Adalberto Baldini
Jeff Overcash (...

Posts: 1,416
Registered: 9/23/99
Re: TIBDataset.FieldByName(Fieldname).IsNull
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 28, 2017 9:14 AM   in response to: Adalberto Baldini in response to: Adalberto Baldini
Adalberto Baldini wrote:
Just assign NULL like usual

frm_Main.IBDts_Fields.FieldByName('FOTO').Value := null;

Jeff Overcash (TeamB)

I get a compilation error :

[dcc32 Error] ImageBox_frm.pas(82): E2003 Undeclared identifier: 'null'

but all works with

frm_Main.IBDts_Fields.FieldByName('FOTO').Value := '';

Adalberto Baldini

NULL has always been defined in the System.Variants unit since D6.

--
Jeff Overcash (TeamB)
(Please do not email me directly unless asked. Thank You)
Learning is finding out what you already know. Doing is demonstrating that you
know it. Teaching is reminding others that they know it as well as you. We are
all leaners, doers, teachers. (R Bach)
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02