Hey, Im using visual studio 2008 trying to make a windows form application that uses a database. Currently The design looks like this
a Table BandID -> links to a table of Contacts
-> also links to a table of Songs

If i have a member of Table BandID with some contacts or some songs added to it, then why i try to delete it i get an error

Obviously i need to delete the songs and contacts and then the bandID member.

The delete button was auto generated by visual studio, can anyone help me with possibly deleting these items in the correct order, via code or by some feature in visual studio

thanks in advance

Source code: www.suppresspro.com/quartz

currently i do not know where the code is hidden for the auto generated delete function... It is located on form BandInfo, Please check out the source code above.

7 Years
Discussion Span
Last Post by DevC++

I would imagine the error is a foreign key constraint problem. Referential integrity requires that a foreign key value has a matching value in the primary key table. In other words, you cant have a contract that references a band that doesnt exist. Easiest way to overcome this would be to set the database to perform a Cascading Delete on the band table, a cascade means that if you delete a band it will delete any songs or contracts that are related to that band. What database application are you using?

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.