Solved

How to display NULL values in DBGrid ?

Posted on 2003-11-02
1
464 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

706 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now