Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query from two tables in a dataset

Status
Not open for further replies.

jluost1

Programmer
Jun 8, 2001
78
US
My dataset has two tables: Skills and Employee_Skills. Skills has a complete list of SkillName. Employee_Skills has a list of SkillName that an employee has obtained. They are from different databases, and the two tables are filled using dataAdapter with separate DB connections.

Now I want to get a list of those SkillName that are in Skills table, but not in Employee_Skills table. Since the data is already in dataset, I want to get the list from dataset, instead of connecting to two databases again.

How? Thanks.
 
SkillDataTable unusedSkills = MyDataSet.SkillDataTable.Clone();
foreach(EmployeeSkillRow row in MyDataSet.EmployeeSkillDataTable.Rows)
{
DataRow[] foundRow = unusedSkills.Select("[Skill]=" + row.Skill);
if (foundRow.Count == 1)
{
unusedSkills.Rows.Remove(foundRow[0]);
}
}

return unusedSkills;

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top