- For individual users
- Instant access to solutions
- Ask your tech questions
- Start your 30-day Free Trial
Main Topics
Browse All TopicsHi Experts. I am new to ASP.NET, so please be gentle!
Assuming I have two identically strcutured DataTables each populated with slightly different data, what would be the most efficient way of doing the following?:-
1) Delete all rows from table B that don't have similar entries in table A
once that is done, then
2) Delete all rows from table A that do have similar entries in table B
I have already got this working using loops and popluating copies of the datatables etc, but i wondered if there is a more efficient way, maybe using DataSet relations?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: deanvanrooyenPosted on 2006-07-13 at 12:32:03ID: 17102848
thats interesting, I am also new to datarelation but this is my opinion
ables["nam e"].Column s["id"], Tables["phone"].Columns["n ameid"]);
);
usualy I use the datarealtion like so, if you were to use it to do what you are thinking it should work but how are you going to update the database? - do you need to update the db?
idea here logically using a normal way
table name
id name
1 steve
2 ben
table phone
id nameid phone
1 2 70...
2 1 70...
and then relate name to phone on name id and phone nameid,
generally like so
DataRelation sectquery = new DataRelation("sectquery",T
foreach (DataRow r in Tables["name"].Rows)
{
DataRow[] childrows = r.GetChildRows("sectquery"
foreach (DataRow cr in childrows)
{
... do something
}
}
in winforms this work like a charm the datasource is "conected" to the db ,but with asp.net, I am not sure how you are currently updating the database, you would still have to manually check what records are gone etc, the db is disonnected from the dataset, it might be easier to do what you are doing, maybe you could use the same process but optimise it(if it can be done)... are you checking the datasets and then manually firing sql to the db?
what do you think?