field can not be found in virtualtable

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
jkuiper_nelis
Posts: 4
Joined: Thu 27 Nov 2014 09:58

field can not be found in virtualtable

Post by jkuiper_nelis » Tue 27 Jan 2015 13:17

I have a ODBC connection which has fields build as tablename>.<fieldname>.
Assign the query is not a problem, but the property indexfields doesn't know whet to do.
Project *.exe raised exception class Exception with message 'Field DEBOPENPST.CDDEBITEUR not found'.
If I remove the DEBOPENPST, CDDEBITEUR can not be found.

This is my query (with adoconnection and ODBC)

Code: Select all

SELECT DEBOPENPST.BOEKJAAR, DEBOPENPST.CDDEBITEUR, 
             DEBOPENPST.FACTNUMMER, DEBOPENPST.FACTSALDO, 
             DEBOPENPST.FACTSALDOVAL, DEBOPENPST.OPENSTAAND, 
             DEBOPENPST.CDDAGBOEK, DEBOPENPST.PERIODE, 
             DEBOPENPST.FACTDATUM, DEBOPENPST.VERVALDATUM1, 
             DEBOPENPST.VERVALDATUM2, DEBOPENPST.CDVALUTA, 
             DEBOPENPST.CDBETCOND, DEBOPENPST.CDBTW, 
             DEBOPENPST.CDAANMANEN, DEBOPENPST.AANGEMAAND, 
             DEBOPENPST.FACTBEDRAG, DEBOPENPST.FACTBEDRAGVAL, 
             DEBOPENPST.REFERENTIE, DEBOPENPST.KVC, 
             DEBOPENPST.BETKENMERK, DEBOPENPST.CDVERT, 
             DEBOPENPST.TRANSACTIE
FROM SYSADM.DEBOPENPST DEBOPENPST 
WHERE DEBOPENPST.BOEKJAAR = :boekjaar
ORDER BY DEBOPENPST.CDDEBITEUR, DEBOPENPST.FACTNUMMER
This is the code I use

Code: Select all

  QDebopenpst.active := true;
  CDSDebopenpst.assign(QDebopenpst);
  QDebopenpst.active := false;
  CDSDebopenpst.IndexFieldNames := 'DEBOPENPST.CDDEBITEUR';
I'm running MyDAC 8.13.x on Delphi 2009 pro

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: field can not be found in virtualtable

Post by ViktorV » Wed 28 Jan 2015 06:52

To fix the problem, set the TVirtualTable.IndexFieldNames property to a column name without specifying the table name. For example: CDSDebopenpst.IndexFieldNames := 'CDDEBITEUR';

Post Reply