How to: Query/Subquery against 2 datasets within application?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm writing a .NET 2.0 windows forms application to do Phone maintenance. I
have 2 databases that exist on separate database servers, Employees and
Phones. They both use a common key, EmployeeNumber. I have been using a
subquery approach to populate a combo box with the Employees not in the
Phones database to help with inputting new employees. I utilize a linked
server to make it work and that works fine. I also populate a couple of
datasets in my application, Employees and Phones using 2 different connection
strings.

I was thinking since I already have this data in my application it seems
foolish to have to maintain a linked server and make a separate trip to the
server to get this data. I'd like to figure out how to do my query/subquery
inside my application instead of making a trip to the database. Is there a
way to do this?

Thanks,

John
 
Here's the query/subquery -- I meant to include it:

select EmplNo = CAST(RIGHT(RTRIM(Empl_No),4) as int),
LastName,FirstName,FullName,Dept_no,Sub_Dept,HireDate
from sqlServer6.county.dbo.empl
where CAST(RIGHT(RTRIM(Empl_No),4) as int) not in
(select intEmployeeNumber from PHONE
where intEmployeeNumber is not null)
order by HireDate desc

John
 
Tuna Fly

The QuerADatatset assumembly I've developed let's you issue queries and
sub-queries against a single Dataset. It lets you perform complex SQL
SELECT statements including UNION, JOINS, GROUP BY, HAVING, ORDER BY,
sub-queries, functions, etc against the tables in a dataset.

Adrian Moore
http://www.queryadataset.com
 
Back
Top