Is DateTime2 datatype supported?

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for SQL Server in Delphi and C++Builder
Post Reply
Mark de Waal
Posts: 12
Joined: Wed 14 Sep 2011 09:29

Is DateTime2 datatype supported?

Post by Mark de Waal » Wed 14 Sep 2011 09:47

Hello,

At the moment we use the standard dbExpress driver for MS SQL Server, but are looking for alternatives, so I am experimenting with the trial version of dbxsda 4.80/5.00beta

Does dbxsda 4.80/5.00beta support the DateTime2 datatype for parameters and fields?

In the RAD Studio 2010 IDE I have a TSQLConnection set up and connected to a TSQLStoredProc.
When I fill the storedprocname in the object inspector, the parameters are automatically defined, unless the stored procedure has a DateTime2 parameter; in that case no parameters are defined (I guess due to an exception, but none is shown)

When I add all fields to a TSQLStoredProc, a DateTime2 column in the stored proc resultset is defined as a TWideStringField.

Is DateTime2 supported? Am I doing something wrong?

TIA
Mark de Waal

AndreyZ

Post by AndreyZ » Wed 14 Sep 2011 15:45

Hello,

To solve the problem, you should use SQL Native Client provider. For this, you should set the TSQLConnection.VendorLib property to sqlncli.dll . After this all datetime2 columns will be mapped to TSQLTimeStampField.

Mark de Waal
Posts: 12
Joined: Wed 14 Sep 2011 09:29

Post by Mark de Waal » Thu 15 Sep 2011 08:44

Hello AndreyZ,

Thanks for your reply. I tried it and it indeed solves the TField problem, but the parameter problem still remains.

When the stored procedure has a DataTime parameter, a ftTimeStamp parameter is automatically created when I set the procedure name. When the stored procedure has a DataTime2 parameter, no parameters are created.

When I manually add a ftTimeStamp (input)parameter, the stored procedure can be executed though and the parameter has the correct value. Note: it can even be set to values that are outside the range of the DateTime datatype, like 'january 1 1000', so the driver seems to work OK

Is this a bug or am I still doing something wrong?
BTW I use SQL Server 2008R2; client library sqlncli10.dll (ver 2009.100.1600.1)

AndreyZ

Post by AndreyZ » Thu 15 Sep 2011 12:24

Thank you for the information. We have reproduced this problem and fixed it. This fix will be included in the next dbExpress driver for SQL Server build. We are going to release dbExpress driver for SQL Server this week.

Mark de Waal
Posts: 12
Joined: Wed 14 Sep 2011 09:29

Post by Mark de Waal » Thu 15 Sep 2011 13:02

Thanks!

Post Reply