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.

Recommended Answers

All 2 Replies

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?

I'm using SQL, cascading worked, thank you very much for your time

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.