insert record in tabel with foreign keys

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
alpha
Posts: 9
Joined: Thu 15 Jan 2009 22:57

insert record in tabel with foreign keys

Post by alpha » Wed 02 Dec 2009 14:56

Hi all,

I'm a relative beginner, usings databases on a mysql Linux server.
I have two tabels :namen and frames.
namen:
id (prim index)
naam

frames
id (prim index)
id_speler1 (foreign key references namen(id)
...

I use the following code:
frames.Insert;
frames['date']:=DateToStr(date);
frames['time']:=TimeToStr(elapsed);
frames['duur']:=TimeToStr(Elapsed);
frames['id_speler1']:=id_naam1;
frames['id_speler2']:=id_naam2;
frames.post;

And get the message:
Cannot acces field 'id_speler1' as type variant

If I don't use foreign keys, All works ok.

Must be something simple, advice would be welcome

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

Post by Dimon » Thu 03 Dec 2009 08:04

I can not reproduce the problem.
Please send me a complete small sample to dmitryg*devart*com to demonstrate it, including a script to create and fill table.

Also supply me the following information:
- the exact version of MyDAC. You can see it in the About sheet of TMyConnection Editor;
- the exact version of your IDE;
- the exact version of MySQL server and client. You can see it in the Info sheet of TMyConnection Editor.

Post Reply