Page 1 of 1

Cannot access field 'XXXX' as type Integer

Posted: Sun 24 Sep 2006 02:48
by craigmadsen
DataModule3.Query1.SQL.Clear;
DataModule3.Query1.SQL.Add( 'SELECT League FROM LEAGUE ');
DataModule3.Query1.Active := TRUE;
if DataModule3.Query1.RecordCount > 0 then begin
DataModule3.Query1.First;
League_No := DataModule3.Query1.Fields[0].AsInteger;
end;

This code used to work just fine, but I've upgraded to Windows XP, and all xxxx broke loose. I've upgraded to MyDAC 4.40 Trial Version (though I own a valid copy of MyDAC -- are there upgrade discounts?), and now I'm getting the following error with above query using a TMyQuery component:

Cannot access field 'League' as type Integer

I'm using MySQL 4.015. I'm using Delphi 7 Professional.

Any help would be greatly appreciated!

Thanks.

Posted: Mon 25 Sep 2006 11:17
by Antaeus
Please specify what type has this field on the server (INT, VARCHAR, etc.) and what class has this field on the client (TIntegerField, TStringField etc.).

Posted: Tue 26 Sep 2006 13:22
by craigmadsen
Please specify what type has this field on the server (INT, VARCHAR, etc.) and what class has this field on the client (TIntegerField, TStringField etc.).

On the MySQL database, that particular field is defined as a TinyInt. When using Navicat MySQL to change this field from a TinyInt to an Int, the program went to the next field that was a TinyInt with the same problem. However, when I try to change this field using the same tool, I'm getting an error (which is not a problem with MyDAC.

So as far as this message/topic is concerned, this issue has been resolved.

Thanks,

Craig

Posted: Tue 26 Sep 2006 18:44
by lucasbr
Tinyint(1) fields are treated like boolean type.

Look at OPTIONS at your TMYQUERY component and change ENABLEBOOLEAN to FALSE and your problem will be solved.

Search this forum for TINYINT and you will find more about this
behavior.