TDate fields problem[solved]

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for SQL Server in Delphi and C++Builder
Post Reply
rafakwolf
Posts: 8
Joined: Mon 13 May 2013 18:58

TDate fields problem[solved]

Post by rafakwolf » Mon 10 Feb 2014 13:42

Hello...

i'm using Delphi xe4 with your driver dbx SQL server 6.2.3 17-May-13

but, when i try to load fields get this error:

Code: Select all

---------------------------
Debugger Exception Notification
---------------------------
Project MyExe.exe raised exception class EDatabaseError with message 'MyQryComp: Type mismatch for field 'MyField', expecting: Date actual: WideString'.
---------------------------
Break   Continue   Help   
---------------------------
Sql Server version is 2012, and the SQL Native Client is installed

How can i solve this ?

Thanks alot.
Last edited by rafakwolf on Thu 13 Feb 2014 10:58, edited 1 time in total.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: TDate fields problem

Post by AlexP » Mon 10 Feb 2014 14:04

Hello,

The problem is due to the fact that the DATE and DATETIME2 field types appeared only in the 2008 server, and you created persistent fields on a machine with Native Client 2005 or OLEDB installed, that doesn't know about these types - and returns the String type for these fields. Native Client 2008/2012 works with these types correctly and returns a correct data type. As a result, you encounter the described problem.
To solve the problem, you can use DataTypeMapping, specifying the type of such field explicitly

Code: Select all

  MSQuery1.DataTypeMap.AddFieldNameRule('date_create', ftDate); //or ftWideString
or setting this rule in the MSQuery editor on the Data Type Mapping tab, and recreating persistent fields after that. Also, you can just delete persistent fields: in this case, the type of this field will be defined differently on each client.

rafakwolf
Posts: 8
Joined: Mon 13 May 2013 18:58

Re: TDate fields problem

Post by rafakwolf » Mon 10 Feb 2014 15:35

Ok but, i'm not using this MSQuery..

i'm using your driver for dbExpress.

In the driver parameters can't be possible solve this issue ?

Thanks

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: TDate fields problem

Post by AlexP » Tue 11 Feb 2014 08:14

To solve the problem in the dbExpress driver, you should either avoid using persistent fields or use one and the same client on all the computers (both development and client).

rafakwolf
Posts: 8
Joined: Mon 13 May 2013 18:58

Re: TDate fields problem[Solved]

Post by rafakwolf » Thu 13 Feb 2014 10:58

OK, thanks for attention.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: TDate fields problem[solved]

Post by AlexP » Thu 13 Feb 2014 12:39

If you have any further questions, feel free to contact us.

Post Reply