I want help to solve this issue. I have a datatable which is created by doing an 'Inner Join' of three tables. This datatable is bound to a datagridview for display of the records. I want to use the bindingsource methods for doing the delete / update on the underlying three tables by using a single tableadapter of this single datatable.

I have searched quite a bit - but just could not get any headway anywhere. It seems the Tableadaptermanager hols the key for this - but the whole thing is very confusing.

Pl help asap.

Renga

Recommended Answers

All 3 Replies

Are you wanting to remove the row from the created table, or from the atomic tables?

Hey guys, that was quite a tricky question!
If you had a new table which was the inner join of multiple other tables, you could easily delete a row on the new table, right?
Or if you want to delete a row from the new table and then, together, deleting the rows with the values inside that deleted row from original tables. You must have a key to delete them with code, like:
If

Select a.*,b.* FROM a as Tbl1 INNER JOIN b as Tbl2 ON a.Key1 = b.Key2

, you should get a query to delete rows having Key1 from Tbl1, Key2 from Tbl2.
At least, show us your code then?

Well, thanks for the quick reply. Let me put the question a bit elaborately. I have tables A and B which are inner joined with Primary and Secondary Keys. The delete etc is set to 'cascade'.

Let us call this table as C.

Now I bind table to a Datagridview. Let us call this as Cdgv.

I want to save the changes to this Cdgv using the dataset.update mwethod. I do not want to use any kind of queries.

This seems to be possible after VS 2008 using the TableAdapterManager feature. But to get this thing work seems to elude me till date !

(Most of the MSDN examples are for a Parent, Child kind in which the parent is there as a series of single text boxes and the child table as a datagridview. I have the codes for Cdgv.validating and Cdgv.validated etc .. which work fine. Also, I have been successfully using the Tableadapter.update on single tables quite successfully).

Hope I have explained the question correctly - the whole thing is about using TableAdapterManager - IMHO.

Rgds

Renga

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.