?
Solved

How to display NULL values in DBGrid ?

Posted on 2003-11-02
1
Medium Priority
?
542 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 27

Accepted Solution

by:
kretzschmar earned 1000 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses
Course of the Month9 days, 7 hours left to enroll

762 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