PC Review Forums Newsgroups Microsoft DotNet Microsoft ADO .NET How to: Query/Subquery against 2 datasets within application?

Reply

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

 
Thread Tools Rate Thread
Old 21-06-2006, 07:01 PM   #1
=?Utf-8?B?VHVuYSBGbHk=?=
Guest
 
Posts: n/a
Default How to: Query/Subquery against 2 datasets within application?


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
  Reply With Quote
Old 21-06-2006, 07:14 PM   #2
=?Utf-8?B?VHVuYSBGbHk=?=
Guest
 
Posts: n/a
Default RE: How to: Query/Subquery against 2 datasets within application?

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" wrote:

> 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

  Reply With Quote
Old 23-06-2006, 01:36 PM   #3
Adrian Moore
Guest
 
Posts: n/a
Default Re: How to: Query/Subquery against 2 datasets within application?

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



"Tuna Fly" <tunafly@mahi.com> wrote in message
news:E8CCC331-D005-4CF1-984E-15AA996C1681@microsoft.com...
> 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



  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off