Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to display NULL values in DBGrid ?

Posted on 2003-11-02
1
Medium Priority
?
578 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

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…
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…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

609 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