Problem with .Value parameters and Date fields

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
badmood
Posts: 37
Joined: Thu 29 Jan 2009 23:28
Location: Italy

Problem with .Value parameters and Date fields

Post by badmood » Thu 27 Jun 2019 09:30

Dear all,

after updating to version 7.5, recompiling my program with

Code: Select all

AQuery.ParamByName('from_date').Value := ADate; // working before 7.5
gives me an error about a incompatible date => integer type

changing to:

Code: Select all

AQuery.ParamByName('from_date').AsDate := ADate;
works as expected.

Regards.


Sergio

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Problem with .Value parameters and Date fields

Post by ViktorV » Tue 02 Jul 2019 05:08

Please specify the DBMS (and its version) you are working with.

badmood
Posts: 37
Joined: Thu 29 Jan 2009 23:28
Location: Italy

Re: Problem with .Value parameters and Date fields

Post by badmood » Tue 02 Jul 2019 14:02

PostgreSQL version 11.4

Regards.

Sergio

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: Problem with .Value parameters and Date fields

Post by MaximG » Wed 03 Jul 2019 08:00

We've tested the operation of UniDAC according to your description and haven't identified any issues. Please send us a full sample demonstrating the issue so that we could further research it. Additionally, we need the DLL script that creates tables and a sample table with data. You may use the e-support form on our website to upload the sample https://www.devart.com/company/contactform.html

badmood
Posts: 37
Joined: Thu 29 Jan 2009 23:28
Location: Italy

Re: Problem with .Value parameters and Date fields

Post by badmood » Fri 05 Jul 2019 10:58

After some call from my customers for errors like "1.5 is not a valid integer" date parameters, I reverted to UniDAC previous version and recompile my programs. Magically the problems vanished.

I can't believe it's working for you.

Fastest sample:
Drop a TUniConnection and connect to any DB with a table containing a DATE field.
Drop a PostgreSQL data provider on the form.
Drop a DateTimePicker on a form.
Drop a TButton on a form.

Code: Select all

procedure TForm1.Button1Click(Sender: TObject);
var
  qryDummy: TUniQuery;

begin

  qryDummy := TUniQuery.Create(self);
  with qryDummy do
  begin
    Connection := UniConnection1;
    SQL.Text := 'SELECT * FROM fatture_t WHERE dt_documento = :dt ';
    ParamByName('dt').Value := DateTimePicker1.Date;
    Open;

    ShowMessage('Ok');

    Close;
  end;

  FreeAndNil(qryDummy);

end;
compiled with version 7.5: run and click on the button: ERROR
compiled with version 7.4: run and click on the button: OK

I'm using Delphi 10.3 (not 10.3.1) if it can be of help.

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: Problem with .Value parameters and Date fields

Post by MaximG » Fri 05 Jul 2019 15:23

Thank you for the information. We have reproduced the issue and will investigate its origin. We will inform you about the results shortly.

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: Problem with .Value parameters and Date fields

Post by MaximG » Tue 09 Jul 2019 16:39

We're still investigating the described issue. As a temporary solution, you can use protocol version 3.0 to work with PostgreSQL data access provider:

Code: Select all

UniConnection.SpecificOptions.Values['ProtocolVersion'] := 'pv30';

badmood
Posts: 37
Joined: Thu 29 Jan 2009 23:28
Location: Italy

Re: Problem with .Value parameters and Date fields

Post by badmood » Wed 24 Jul 2019 15:14

Dear support,

is it resolved in version 8?
Because my SpecificOptions already have pv30 as protocol version.

Regards.

Sergio

badmood
Posts: 37
Joined: Thu 29 Jan 2009 23:28
Location: Italy

Re: Problem with .Value parameters and Date fields

Post by badmood » Sun 01 Dec 2019 17:53

Dear support,

it's been a long time (more than 4 months). Can you tell me if the problem is still there? I have a PostgreSQL server upgrade to do, but I can't use version 12 because I'm still with old version of your components.

I have renewed my subscription specifically for using version 12, can you answer the question please?

Regards.

Sergio

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: Problem with .Value parameters and Date fields

Post by MaximG » Tue 10 Dec 2019 09:38

We've sent you the download link for the nightly build with all necessary changes in an email.

Post Reply