Solved

How to display NULL values in DBGrid ?

Posted on 2003-11-02
1
488 Views
Last Modified: 2010-04-03
Hi!

Can somebody tell me how to display NULL values in a DBGrid ? ... the way things work is it displays an empty field and showing an empty field isn't correct as its missleading since an empty string is not the same as NULL.

BTW, I can easily work around it for TStringField, TBlob, TMemo, but fields such as TDateTime, TDate, TIntegerField isn't that trivial.
0
Comment
Question by:delphi112497
1 Comment
 
LVL 27

Accepted Solution

by:
kretzschmar earned 250 total points
ID: 9666509
usual each tfield has an isNull property,
where could be evaluated if there is a NullValue

>an empty field isn't correct as its missleading
>since an empty string is not the same as NULL.
btw. in oracle an empty varchar2-field is NULL (same as '')

you could use the OnGetText-Event of the TField for Display-Issues like

procedure TForm1.ADOTable1xGetText(Sender: TField; var Text: String;
  DisplayText: Boolean);
begin
  if Sender.IsNull Then
    Text := '{NULL}'  //for example
  else
    Text := Sender.AsString;
end;

meikl ;-)
0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question