We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Master / Detail TIBDataSet not updating database on Insert

nath0rn
nath0rn asked
on
Medium Priority
1,235 Views
Last Modified: 2013-12-09
Hello!

My situation is this. I am currently using Delphi XE and building a simple database app.

The situation involves Instructors and notes for the instructors. So far I have a TIBDataSet for the tblInstructors, and a TIBDataSet for the tblNotes, both with appropriate SQL statements for the insert, delete, etc.

The problem arises when inserting a new Instructor. It will update file (with standard tblInstructors.insert, tblInstructors.post) and having an frmSplash.db_transaction.CommitRetaining; after the post is called. It appears to update fine (by refreshing the table in a separate application for viewing interbase databases, after the post is called). However right after the insert when trying to add a note, it will throw an error (attached in screenshot).

HOWEVER, if I close the application after the instructor has being inserted, then load it again and select the instructor that was inserted, then insert a note, it will work fine.

before the tblnotes are posted, I've put a tblnotesIN_ID.value := tblInstructorsIN_ID.value; to link them, since not havign that will just insert the note without any reference to the instructor. So maybe someone can hint to me the best way to do this, regarading master/detail with TIBDataSet. :)

I hope I have made sense with this, please if anyone has any questions ask away!
error.jpg
Comment
Watch Question

Author

Commented:
I don't think it's an issue with how the database is set up.

For some reason it wont reconise the value is in the parent table until the database is disconnected and reconnected.

Do you think it's an issue with transaction types?
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

Author

Commented:
Hi,

Yes this is what I've had to end up doing. But it can get rather messy since the record number is reset, and stuff like that.

I have it at the moment where it will get the latest entry in the table after being reset, and point to that. But it's not really an elegant solution!

I guess if there is no other comments, I'll accept yours as an answer since it's as close to the answer (so far!)
Mike McCrackenSenior Consultant
CERTIFIED EXPERT
Most Valuable Expert 2011
Top Expert 2013

Commented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.