Page 1 of 1

TDate fields problem[solved]

Posted: Mon 10 Feb 2014 13:42
by rafakwolf
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.

Re: TDate fields problem

Posted: Mon 10 Feb 2014 14:04
by AlexP
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.

Re: TDate fields problem

Posted: Mon 10 Feb 2014 15:35
by rafakwolf
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

Re: TDate fields problem

Posted: Tue 11 Feb 2014 08:14
by AlexP
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).

Re: TDate fields problem[Solved]

Posted: Thu 13 Feb 2014 10:58
by rafakwolf
OK, thanks for attention.

Re: TDate fields problem[solved]

Posted: Thu 13 Feb 2014 12:39
by AlexP
If you have any further questions, feel free to contact us.