TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
icemanind
NA
22
0
Outer Join among multiple Databases in C#
Jan 17 2005 12:14 PM
Hello all. I am trying to write a C# program that will run a query against 2 tables in separate databases. My SQL statement would be as follows: SELECT compcom_jobmstr.JobID AS JobID,compcom_jobmstr.Title1 AS Title1,compspc_jobmstr.Title1 AS Title2 FROM compcom_jobmstr LEFT OUTER JOIN compspc_jobmstr ON compcom_jobmstr.JobID=compspc_jobmstr.JobID; Everything would work fine, if the tables were in the same Database. Unfortunately, the "compcom_jobmstr" and the "compspc_jobmstr" are tables in 2 separate databases. Is there a way to execute a query like this in ADO.NET? Basically what I have is two tables, both with identical fields/columns. The JobID field is a primary/unique field in both tables and what I'm trying to do is pull all the JobID's from the two tables, along with the description (jobmstr.Title). If the same JobID is found in both tables (which is very likely), it should only return the JobID/Title1 record once. I know an alternative way to do it is to open two separate connections, query both tables, store the results of each table in a DataSet, then use a foreach loop to iterate through DataSet2. If the record in DataSet2 is not in DataSet1, it would add it. However, this would take a long time seeing as how there are like 45,000 records....Any help would be appreciated! Alan
Reply
Answers (
0
)
whats bad with odbc
gripe with data binding