Empty (' ') Date fields in SQL Server 2012

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
jrheisler
Posts: 48
Joined: Tue 25 Oct 2011 17:47

Empty (' ') Date fields in SQL Server 2012

Post by jrheisler » Tue 13 Nov 2012 20:57

I recently starting testing a unidac with sql server provider app against a 2012 SQL Server instance rather than the 2008 version I had been testing against.

I found that one of our older Woll2Woll IP component TwwDBDateTimePicker does not get a date.

As it turns out, in the date time picker, if there is no date, it goes to the database and checks Field.AsDateTime. In 2008 Field.AsDateTime returns a zero (0), in 2012 it returns a ' '.

Is there a setting or something for this?

Thanks
Jeff

AndreyZ

Re: Empty (' ') Date fields in SQL Server 2012

Post by AndreyZ » Wed 14 Nov 2012 12:25

Hello,

Most probably that this problem with date formats is caused by the OLEDB provider. The 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 TMSConnection.Options.Provider property to prNativeClient.

jrheisler
Posts: 48
Joined: Tue 25 Oct 2011 17:47

Re: Empty (' ') Date fields in SQL Server 2012

Post by jrheisler » Wed 14 Nov 2012 14:52

I just tried this using the UniConnection, SpecificOptions, Options for provider SQl Server, setting OLEDBProvider=prNativeClient.

When I run the app, and it tries to Uniconnection.Open I get an error in EDatabaseError of 'Required provider is not installed'

This is Devart 4.1.6 for Delphi 7.

Thanks!

AndreyZ

Re: Empty (' ') Date fields in SQL Server 2012

Post by AndreyZ » Wed 14 Nov 2012 14:58

I moved this topic to the UniDAC forum.

AndreyZ

Re: Empty (' ') Date fields in SQL Server 2012

Post by AndreyZ » Wed 14 Nov 2012 15:00

The point is that UniDAC supports SQL Server Native Client 11 (SQL Server 2012) since version 4.2.7. To solve the problem, you should upgrade UniDAC at least to version 4.2.7.

jrheisler
Posts: 48
Joined: Tue 25 Oct 2011 17:47

Re: Empty (' ') Date fields in SQL Server 2012

Post by jrheisler » Wed 14 Nov 2012 16:55

Upgraded, works like a charm. Thanks!!!

AndreyZ

Re: Empty (' ') Date fields in SQL Server 2012

Post by AndreyZ » Thu 15 Nov 2012 10:06

It is good to see that the problem was solved. Feel free to contact us if you have any other questions about UniDAC.

Post Reply