MS SQL 2008 (R2) new data types

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
roman.vitek
Posts: 2
Joined: Thu 19 Jul 2012 11:28

MS SQL 2008 (R2) new data types

Post by roman.vitek » Thu 19 Jul 2012 12:01

Hi, I have problems with new data types for MS SQL Server 2008 (R2):
DATE, TIME, DATETIME2

When I use UniQuery I get this:
A = DATE field
B = TIME(0) field
C = DATETIME2(0) field

UniQuery.FieldByName("A").DataType = ftWideString // correct is = ftDate
UniQuery.FieldByName("B").DataType = ftWideString // correct is = ftTime
UniQuery.FieldByName("C").DataType = ftWideString // correct is = ftDateTime

Thanks, Roman

AndreyZ

Re: MS SQL 2008 (R2) new data types

Post by AndreyZ » Thu 19 Jul 2012 12:51

Hello,

This problem is caused by the OLEDB provider. OLEDB provider returns DATE, TIME, DATETIME, and DATETIME2 columns in the string format. To solve the problem, you should use the SQL Native Client provider. To use SQL Native Client, you should set the OLEDBProvider specific option to prNativeClient. Here is an example:

Code: Select all

UniConnection.SpecificOptions.Values['OLEDBProvider'] := 'prNativeClient';

Post Reply