Help with BDE and SQL Update Dates in Paradox Tables 
Author Message
 Help with BDE and SQL Update Dates in Paradox Tables

Hi all!!

I've got this wee bit of a problem with date formats.

Basically, I've got an SQL Update Statement on a Paradox table which updates a
date field. Somehow, It isn't using the correct D/M/Y formats and throws a
Type Mismatch.

In Update:

        "Update table set date_entry = "20/4/1997'

My Regional settings are set to DD/MM/YYYY

and the BDE Date mode is set to 0. But I chaged it to 1... but same prob.

The date is displayed correctly when querried.... ie DD/MM/YYYY... but BDE
insists I use MM/DD/YYYY when updating or inserting...

Btw, Using BDE 3.5....

Has anyone come accross this before? And is there a way around this without
resorting to hard coding date formats?

I would appreciate any of your feedbacks on this and thanks in advance!!


well....:))

Naz.



Wed, 18 Jun 1902 08:00:00 GMT  
 Help with BDE and SQL Update Dates in Paradox Tables

hi,

paradox uses the date format defined in the BDE .i wrote a simple unit that
helps me to fromat a date string to the correct format needed by the BDE :

----------------------------------------------------------------------------
--------
unit BDEUtil;

interface

  Procedure ReadBDEConfig;
  Function FormatSQLDate(d : TDateTime) : String;

implementation
uses
  Classes, DBTables, SysUtils, DphiUtil;

Type
  TDateOrder = ( doMDY, doDMY, doYMD);
  TBDEDateSettings = record
    Order : TDateOrder;
    Separator : char;
    FourDigitsYear : Boolean;
    sFormat : String;
  end;

var
  glbBDEDate : TBDEDateSettings;

Procedure ReadBDEConfig;
var
  Entries : TStringList;
  YearFormat : String[4];
begin
  try
    if Assigned(Session) then
    begin
       Entries := TStringList.Create;
       Session.GetConfigParams('\SYSTEM\FORMATS\DATE','',Entries);
       glbBDEDate.Order := TDateOrder(StrToIntDef(Entries.Values['MODE'],
0));
       glbBDEDate.Separator := (Entries.Values['SEPARATOR'])[1];
       glbBDEDate.FourDigitsYear := (Entries.Values['FOURDIGITYEAR'] =
'TRUE');
       {build the BDE/SQL Date Format String}
       with glbBDEDate do
       begin
          if FourDigitsYear then
             YearFormat := 'yyyy'
          else
             YearFormat := 'yy';

          case Order of
          doMDY : sFormat := 'mm' + Separator + 'dd' + Separator +
YearFormat;
          doDMY : sFormat := 'mm' + Separator + 'dd' + Separator +
YearFormat;
          doYMD : sFormat := YearFormat + Separator + 'mm' + Separator +
'dd';
          end;

       end;
    end;
  Except
    on e: Exception do
       GenExceptMsg(e, 'ReadBDEConfig');
  end;
end;

Function FormatSQLDate(d : TDateTime) : String;
begin
  Result := FormatDateTime(glbBDEDate.sFormat, d);
end;

end.

----------------------------------------------------------------------------
-------------------

======================================
MIND CTI ltd.
Computer Telephony Software

POB 144, Yoqneam Illit 20692, ISRAEL.
Tel: +972-4-993-7773  
Fax: +972-4-993-7776

Visit our site: http:\\www.mind.co.il
======================================
            Keep us in mind !!
======================================



Quote:

> Hi all!!

> I've got this wee bit of a problem with date formats.

> Basically, I've got an SQL Update Statement on a Paradox table which
updates a
> date field. Somehow, It isn't using the correct D/M/Y formats and throws
a
> Type Mismatch.

> In Update:

>         "Update table set date_entry = "20/4/1997'

> My Regional settings are set to DD/MM/YYYY

> and the BDE Date mode is set to 0. But I chaged it to 1... but same prob.

> The date is displayed correctly when querried.... ie DD/MM/YYYY... but
BDE
> insists I use MM/DD/YYYY when updating or inserting...

> Btw, Using BDE 3.5....

> Has anyone come accross this before? And is there a way around this
without
> resorting to hard coding date formats?

> I would appreciate any of your feedbacks on this and thanks in advance!!


> well....:))

> Naz.



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Help with SQL Date functions with Paradox Tables in WHERE clause

2. BDE 5.0 SQL on Paradox tables so slow in comparisont to BDE 2.52

3. Update paradox table (BDE)

4. Index Out of Date Paradox 5.0 Table (BDE)

5. Delphi1 and SQL-Date ind Query for paradox table

6. SQL on date-field in Paradox-table??

7. Update JOINed tables in Paradox using SQL

8. HELP PLEASE Index Out of date on paradox tables - delphi 6

9. Updating Paradox 5 tables to Paradox 7

10. Cached Updates QUESTION: Sorting table of updated and non-updated records

11. Help with SQL Statement applied to Paradox tables

12. Help on storing SQL Table result to a Paradox file

 

 
Powered by phpBB® Forum Software