Subject | Re: Inserting into detail table of Master/Detail |
---|---|
Author | radevojvodic |
Post date | 2005-12-27T07:57:38Z |
Sorry,
My mistake. Your Insert statement is OK.
Rade
I'll take a look again.
My mistake. Your Insert statement is OK.
Rade
I'll take a look again.
--- In IBObjects@yahoogroups.com, "Rick Roen" <rick@l...> wrote:
>
> IBO 4.5B D7 XP sp2
>
> I have a master/detail relationship setup between two tables and
> need to insert new records into the detail table. When I am using
> the query form from the IBO_Query (when you double click on the
> component) I enter a master parameter, open the table, get the
> expected records, but the "+" key from the menu is never enabled so
> I can't insert. I can edit ok from here.
>
> The same happens when I run my program, however I get a Foreign Key
> Violation when I try to post. I have examined the values in the
> BeforePost event and they all look ok.
>
> If I remove the master/detail relationship I can post new records.
>
> Any ideas?
>
> below is the detailed info.
>
> Rick
>
> DETAIL TABLE:
>
> SELECT IDNUM
> , MIXNUM
> , B1.NAME MIX_NAME
> , SEEDNUM
> , B2.NAME SEED_NAME
> , MIX_PERCENT
> , COLOR
> FROM SEED_MIXTURES S
> JOIN BULK_SEED B1 ON B1.ITEMNUM = S.MIXNUM
> JOIN BULK_SEED B2 ON B2.ITEMNUM = S.SEEDNUM
>
> Master source: BULK_SEED
> Master links: SEED_MIXTURES.MIXNUM=ITEMNUM
>
> Insert SQL:
>
> INSERT INTO SEED_MIXTURES(
> IDNUM, /*PK*/
> MIXNUM,
> SEEDNUM,
> MIX_PERCENT,
> COLOR)
> VALUES (
> :IDNUM,
> :MIXNUM,
> :SEEDNUM,
> :MIX_PERCENT,
> :COLOR)
>
> Table DDL
>
> RECREATE TABLE SEED_MIXTURES
> (
> IDNUM INTEGER NOT NULL,
> MIXNUM INTEGER NOT NULL,
> SEEDNUM INTEGER NOT NULL,
> MIX_PERCENT SMALLINT DEFAULT 0 NOT NULL,
> COLOR VARCHAR( 25),
> CONSTRAINT PK_SEED_MIXTURES PRIMARY KEY (IDNUM)
> );
>