3

I am using Delphi 2010 dbexpress components to connect to my MySQL database. I am facing a problem executing this query.

  SQLQuery1.SQL.Clear;
  SQLQuery1.SQL.Add('Select ForNo,Description from fortab');
  SQLQuery1.Open; 

It gives me an error saying
DBX Error :Unsupported field type.
now if I have the only 1 field in the query it will work fine i.e.

Select Description from fortab; 

or

Select ForNo from fortab;  

fortab structure 
    ForNo: int(10) unsigned  NOT NULL, Primary key
    Description: varchar(45) NOT NULL,
    ENGINE=InnoDB DEFAULT CHARSET=latin1;

Can anyone specify me the proper format of retrieving multiple fields from the table?
Or is it that I will have to write individual queries for each field?

Shirish11
  • 1,587
  • 5
  • 17
  • 39
  • Can you post the definition of your table? It's hard to say what your problem might be without it. What are the column names and data types? – Ken White Feb 17 '12 at 05:01
  • @KenWhite have edited my question with table structure – Shirish11 Feb 17 '12 at 05:12
  • Which version of MySQL and LibMySQL.dll are you using? – RRUZ Feb 17 '12 at 05:15
  • What is `int(10)`? I don't use MySQL, but an `int` should be an `int`, and shouldn't need a width specifier. Are you sure that's right? – Ken White Feb 17 '12 at 05:15
  • @KenWhite int(10) is supported in MySQL. – Shirish11 Feb 17 '12 at 05:35
  • @RRUZ MySQL : 5.5 and LibMySQL.dll : 5.5.11.0. also facing problems with libmysql.dll getting errors for `libmysql.dll not fount in system path` any views how do i tackle it. – Shirish11 Feb 17 '12 at 05:39
  • I use Mysql 5.1 with dbexpress without problems, maybe your issue is related to the Mysql version ,because according to the documentation dbexpress support Mysql 4.0, 5.0 and 5.1 versions (http://support.codegear.com/article/39758) – RRUZ Feb 17 '12 at 05:45
  • @Shirish11 - didn't know that; thanks. I learned something new. :) – Ken White Feb 17 '12 at 06:01
  • @RRUZ can u tell me where do I have to place LibMySQl.dll? – Shirish11 Feb 17 '12 at 06:08
  • @Shirish11, I use a folder included in the `PATH` enviroment variable, something like `Windows\System32`, but remember I use mysql 5.1 not 5.5. – RRUZ Feb 17 '12 at 06:12
  • @RRUZ `Path` as in the `system path` or `user path` cause i still cant get it going with MySQL 5.0.21 – Shirish11 Feb 17 '12 at 06:34
  • I suggest using ADO and not DBX to connect to MySQL. – Johan Feb 17 '12 at 10:53
  • @Johan possibly that's the only option left with me :( – Shirish11 Feb 17 '12 at 11:18
  • Try casting the fields as char Select cast(ForNo as Char(10)) as CForNo, Description ... – A Lombardo Feb 17 '12 at 15:06

1 Answers1

1

Can anyone specify me the proper format of retrieving multiple fields from the table?

SELECT field1, field2, field3 FROM atable
WHERE field1 > 100
ORDER BY field1
Johan
  • 74,508
  • 24
  • 191
  • 319
  • I know but its not working for me. I have tried the same query using `BDE and MyDAC` it works fine but when it comes to `dbExpress` it fails. Have also tried the same in `BDS 2006` but no success. – Shirish11 Feb 17 '12 at 11:14