Главная страница | назад





Article #19255: MS Access and tryingto detect Null blobs using TBlobField.IsNull method

 Question and Answer Database

FAQ4255B.txt - MS Access and tryingto detect Null blobs using TBlobField.IsNull method

Category   :Database (MSACCESS)
Platform   :Win95/NT
Product    :C++Builder3.x,   Delphi3.x,   Delphi4.x,   

Question:
I have an MS Access table with blob fields in it.  When I use the TBlobField.IsNull
method it always returns True whether the blob field has data or is Null.  This 
same test works fine with Paradox and if do a query against the MS access table to 
look for null blobs (for example select * from blobtest where blob1 IS NULL) it 
detects and shows the records with empty blobs correctly. What is wrong and how
can I work around it?

Answer:
The DAO engine does not know without opening the Blob if it is null or not.  The BDE
would have to open the all the Blob fields at every getrecord call for the TBlobField.IsNull 

function to work correctly. This would be a huge performance hit even though IsNull may 

never be used. A workaround is to use .AsString and check the length:

before:
(assume that Table1blob1 is a TBlobField)
if Table1blob1.isNull then

after:

if Length(Table1blob1.AsString) = 0) then

3/26/99 11:00:59 AM
 

Last Modified: 01-SEP-99