[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to display NULL values in DBGrid ?

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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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…
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…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses
Course of the Month18 days, 14 hours left to enroll

834 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