Cannot access field 'Field' as type Variant.

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
FerCastro
Posts: 47
Joined: Mon 26 Jun 2006 17:32
Location: México City
Contact:

Cannot access field 'Field' as type Variant.

Post by FerCastro » Tue 22 Jan 2008 04:57

Hello Fiends,

I have a DBLookupCombobox and it seems i have all the settings ok, but after I choose the data and lost the focus of the Combobox i get the message:

Cannot access field 'Field' as type Variant.

I don't know if the MyDac component has a bug working with the DBLookupCombobox, but I have tryed with several components (Delphi native, DBExpress, etc) and always get the same error.

Delphi 7
MyDac 4.40.0.18
WXP SP2

Thanks and best regards.

Fernando Castro
Mexico, D.F.

FerCastro
Posts: 47
Joined: Mon 26 Jun 2006 17:32
Location: México City
Contact:

Solved..

Post by FerCastro » Tue 22 Jan 2008 05:04

Most probably, you use TLargeIntField (BIGINT or UNSIGNED INT). This field cannot be used as Lookup (see method TLargeintField.SetVarValue). Declare this field at the server as INT.

Thanks and please forgive any bother. I didn't see the post at first sigth.

Best regards

Fernando Castro
Mexico, D.F.

Karysf
Posts: 2
Joined: Sun 03 May 2009 10:41

Post by Karysf » Tue 05 May 2009 09:44

I am using an embedded mysql database.

I'm using SELECT 1,2,3 kind of statements, and the problem is that mysql returns them all as BIGINT. Using a user created function to cast it to a simple int would be fine, but embedded database does not allow creation of custom user functions.

How to overcome this ? Is there a possibility to change the type of value on the component itself ?

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Wed 06 May 2009 07:26

To solve the problem you should set the TMyConnection.Options.OptimizedBigInt property to True.

Karysf
Posts: 2
Joined: Sun 03 May 2009 10:41

Post by Karysf » Wed 06 May 2009 07:56

I'm using version 3.55.0.25
Since wich version is this option available ?

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Wed 06 May 2009 08:36

This option is availabled since MyDAC version 5.20.1.14.

Post Reply