Solved

DB Grid Question - Urgent !

Posted on 1998-07-19
16
391 Views
Last Modified: 2010-04-04
Could someone please advise on how I can get the DB Grid component in Delphi 3 to display a date field as a four digit year.

I have found a couple of components e.g. Edit and DBEdit which takes the date in as a four digit year and the Paradox tables accept the year in four digits, but when it comes to displaying the date,niether the DB Grid/DB Edit or DB Lable in Delphi 3 displays the year 2000 as that, they display it as 00.

Can someone help or even suggest a site where I can locate a component to do the job.

Thanks in advance

0
Comment
Question by:tam97
  • 6
  • 4
  • 3
  • +2
16 Comments
 

Expert Comment

by:gaona
ID: 1358209
Dear Advance,  
 
If that you want it is an entrance and an exit in a DBGrid or DBEdit in the format '' dd/mm/yyy '', make the following:  
In the property Display format of the wanted field he types the string: [''dd/mm/yyyy '']  
observe that as this property he/she has a string as property, don't type quotation marks and yes two comas.  
In the property EditMask, type the string [!99/99/0000;1;_] without quotation marks or comas.  
I tested this solution and she worked.  
 
Hugs, Gaona.  
 
Obs.: Excuse me if my English is not good.
0
 

Expert Comment

by:gaona
ID: 1358210
Dear Advance,  
 
If that you want it is an entrance and an exit in a DBGrid or DBEdit in the format 'dd/mm/yyyy', make the following:  
In the property Display format of the wanted field he types the string: [''dd/mm/yyyy'']  
observe that as this property he/she has a string as property, don't type quotation marks and yes two comas.  
In the property EditMask, type the string [!99/99/0000;1;_] without quotation marks or comas.  
I tested this solution and she worked.  
 
Hugs, Gaona.  
 
Obs.: Excuse me if my English is not good.
0
 

Author Comment

by:tam97
ID: 1358211
Thanks for speedy reply, I'll try your suggestion and get back to you.

Regards John
0
 

Author Comment

by:tam97
ID: 1358212
Gaona

I think I clicked the wrong option as it has came up as a rejected answer which it is not, sorry !

I'll get back to you

Regards John
0
 
LVL 3

Expert Comment

by:Matvey
ID: 1358213
Uses BDE;
Procedure fDbiSetDateFormat;
var
  fDate : FMTDate;
begin
  fDate.szDateSeparator := '/';          { Specifies date separator character }
  fDate.iDateMode := 0;                 { Date format. 0 = MDY, 1 = DMY, 2 = YMD. }
  fDate.bFourDigitYear := TRUE;         { If TRUE, write year as four digits. }
  fDate.bYearBiased := FALSE;            { On input add 1900 to year if TRUE. }
  fDate.bMonthLeadingZero := FALSE;      { Month displayed with a leading zero if TRUE. }

  fDate.bDayLeadingZero := FALSE;        { Day displayed with leading zero if TRUE. }

  Check(DbiSetDateFormat(fDate));
end;

Looks like THE thing? Well, I'm not sure. I think it has a different purpose:

Usage

The date format is used by QBE (Query By Example language) for input and wildcard character matching. It is also used by batch operations (such as DbiDoRestructure and DbiBatchMove) to handle data type coercion between character and date types.

(BDE API help on value DbiSetDateFormat}

I also found another very stupid line in the help:
"Paradox date fields can contain any valid date from January 1, 9999 BC to December 31, 9999 AD. To change the default display of a date field, use Paradox."

Well, it seems like you have to install Paradox - Borland moves to MS policy? ("You can't shoot your foot using Access. To shoot your right foot install FoxPro. To shoot your left foot install Informix...")

I also searched for Grid components in Delphi pages, but didn't find any. In case you don't know:
http://www.delphipages.com/
http://bes.trendline.co.il/torry/
http://sunsite.icm.edu.pl/delphi/
0
 

Author Comment

by:tam97
ID: 1358214
Hi Matvey

Thanks for your detailed reply, I'm quite new to Delphi so excuse the following (possibly stupid)comment to your reply.

I'm not sure how the procedure you quoted should be implemented, or where in the program, could you assist ?.

Good point made about (Borland/MS) !, I did set the date field in Paradox with a four figure mask which it accepted OK, the Paradox field will accept 2000 but the bloody DB Grid only displays 00.

Like yourself I've tried the sites you gave to no avail.

Thanks again for your time, I'll set about trying your procedure.

Regards John
0
 
LVL 3

Expert Comment

by:Matvey
ID: 1358215
Just add the BDE unit on the top of yours and copy this procedure. You can call it after you open your table (eg initialize the BDE). My point was that I'm not sure it's working - I posted it's description which says that DbiSetDateFormat is meant for BatchMoves or something. Too bad :(
Tell me if it produces a result at all. You can also do another thing of the same king: goto BDE administrator-configuration tab-system-formats-DATE. Here you can set the formatting of date, but it seems to have no effect. Can anybody else exaplin it maybe?
0
 

Accepted Solution

by:
gaona earned 300 total points
ID: 1358216
Dear Tam97  
If that you want it is a component TDateEdit, that accepts entrance of data with 4 digits for the year, several components exist Super in the pages of Delphi Page (www.sunsite.icm.edu.pl/delphi /), Torrys (www.torry.webnorth.with /), Delphi Exchange (www.dephiexchange.with /).  
Try the component DateEditPlus with first DBGridSupport V. 4.1, located in:  
 
      www.torry.webnorth.com /  
        Database Components  
          DataBase Acess #1  
            DateEditPlus with DBGridSupport V. 4.1  
 
I believe that this is the component that you need.  
 
Regards Gaona
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 1

Expert Comment

by:venks
ID: 1358217
Dear Tam97
Have you tried setting WINdows97/Start/Settings/regional seettings/Date and choose the format(4 figure date format) that you desire.This is what I have been doing and is working fine
0
 

Author Comment

by:tam97
ID: 1358218
Hi Venks

Have tried your suggestion, Works perfectly first time,
thank you very much indeed.

I have to award the points to you as you supplied the precise answer, but I would like to thank the other experts who gave their time trying to help.

Many thanks again

Regards John
0
 
LVL 1

Expert Comment

by:venks
ID: 1358219
As per tam97 reply she seems to have accepted my reply and i am really glad i could be of some use.Incidentally this was my first answer and feel honoured that my first attempt has been successful
How is it that tam97 has accepted  my answer and some one else(gaona) gets the point.May be some one will clarify this
0
 

Author Comment

by:tam97
ID: 1358220
Venks

Your reply was spot on and you deserved the points, now that you have pointed out that the points have gone to another expert I can only assume that when I accepted your answer the system must have been sitting or ralating to an original part of the history.

I'm sorry this happened and it's most certainly been my fault, could you contact the administrator and have the points awarded to yourself, if for no other reason that a matter of principal, I'll see what I can do my end.

I hope that this does not put you off answering peoples questions as you have assisted many with the same problem.

Rgds John
0
 
LVL 1

Expert Comment

by:venks
ID: 1358221
I have poted a question to the customer service forum to put the matters right
Thanks for the reply anyway
0
 
LVL 7

Expert Comment

by:linda101698
ID: 1358222
tam97,
tam97
There are two ways to post at a question - comments or an answer.  When you grade a question always make sure that the expert you want to receive the points for the question has the proposed answer.  

If the expert you want to receive the points does not have the proposed answer you can reject the current proposed answer by choosing the option below the question "Reopen question to other experts".  Add a comment requesting that the expert you want to award points to post an answer.

OPTION AT QUESTION WITH ANSWER:
1. Grade linda's answer:
   A: Excellent! B: Good! C: Average.
   D: Acceptable. E: Reopen question to other experts.

venks,
Thanks for your answer on this question.  Look in the new questions for one to award you points for your answer.

Linda Gardner
Customer Service @ Experts Exchange
0
 

Author Comment

by:tam97
ID: 1358223
Hi Linda

Thanks for the advice will carry out your instructions from now on.

Rgds John
0
 
LVL 1

Expert Comment

by:venks
ID: 1358224
Dear Linda
I am very happy that the matter has been set right and that too promptly.This is what makes the expert exchange a great place.
Venks
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

707 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

19 Experts available now in Live!

Get 1:1 Help Now