简体   繁体   中英

Delphi7 master detail relations query results in ORA-01036

I'm using Delphi7, Devart's dbExpress driver 4.70.

I drop two TSQLTables (call them A and B ), two TDataSetProviders ( dspA and dspB ), two TClientDataSets ( cdsA and cdsB ), two TDataSources ( dsA and dsB ) and two DBGrids ( gridA and gridB ). Everything is set fine. If I set cdsA.Active to true I can see the data in gridA . The same per cdsB .

Now I want to implement the relation

A JOIN B ON a = b.

The field a is the true A 's foreing key referred by B 's field b and b is B 's primary key too. I set the stuff as follow (I use graphic tools):

cdsB.MasterSource := dsA;
cdsB.MasterFields := a;
cdsB.IndexFieldNames := b;

When I do cdsB.Open , I got this error:

ORA-01036: illegal variable name/number".

The field a value is always null in table A (there is no data). TSQLMonitor reports the following queries: Execute: select * from A

...

Execute: select * from ENTI where (b is NULL)

:1 (Number,IN) = <NULL>

What did I miss, and how can this be fixed?

When using Datasnap, you should set the M/D relationship on the source datasets, not the client ones. It will create a "dataset field" in the master client dataset. You then assign this field to the child client dataset. This approach is also more perfomant.

Anyway it should work as well, it looks there is something wrong with your SQL.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM