Using the Locate with a Table

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
el_ade
Posts: 10
Joined: Fri 08 Apr 2005 03:09
Location: Cancun

Using the Locate with a Table

Post by el_ade » Fri 29 Apr 2005 10:26

I have the following procedure

procedure TFHotInventariosIngresaTarifas.cxButton1Click(Sender: TObject);
var
FecMod : TDateTime;
begin
FecMod := EditFecIni.Date;
while Fecmod <= EditFecFin.Date do
begin
FHotInventarios.TTarifas.Locate('fecpre',DateTimeToUnix(FecMod),[]);
FecMod := IncDay(Fecmod,1);
end; //while
end;

But in the locate line it raise an Access Violation, I think perhaps I´m using the wrong way the locate method (I have many hours with this problem) the DateTimetoUnix was a try to see if this thing works, but doesn´t

The main idea is locate a certain date, and if it does not exist the insert a record or if exists, then update the record.

somebody has an idea?

Thank you

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Fri 29 Apr 2005 14:04

Try to remove DateTimeToUnix function. If 'fecpre' is TDateTime field this function call is not necessary.

el_ade
Posts: 10
Joined: Fri 08 Apr 2005 03:09
Location: Cancun

Post by el_ade » Fri 29 Apr 2005 17:10

The Result is the same,
"Access violation at address 0041D233"

FHotInventarios.TTarifas.Locate('fecpre',FecMod,[]);

I have even tryed to use the locate with other fields, with the same access violation.

Could it be a bug in the TMyTable? I´m using Delphi 2005 with windows XP and the mySQL database is remotelly connected

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Wed 04 May 2005 06:23

We couldn't reproduce the problem.
Please send us complete small sample to demonstrate it and include script to create and fill table.

Post Reply