473,385 Members | 1,630 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

how to pull/query data from 2 Databases into 1 table using .Net?

Hello,

I need to pull data from 2 tables that reside on the same sql server but 2
different databases. In Query Analyzer I can say this

select t1.*, t2.* from tbl1 t1 join database2.dbo.tbl1 t2 on t1.RecordID =
t2.RecordID

The .Net sql command object does not appear to support this kind of syntax.
I need to populate one datagridview with the data from DB1.tbl1 and
DB2.tbl1. Is there a way to do this?

Thanks,
Rich
May 16 '06 #1
3 4300
Well, it turns out that the Sql Command object does support this kind of
syntax. It seems that I left out the reference to DB2 in my sql string.
Bummer man!

"Rich" wrote:
Hello,

I need to pull data from 2 tables that reside on the same sql server but 2
different databases. In Query Analyzer I can say this

select t1.*, t2.* from tbl1 t1 join database2.dbo.tbl1 t2 on t1.RecordID =
t2.RecordID

The .Net sql command object does not appear to support this kind of syntax.
I need to populate one datagridview with the data from DB1.tbl1 and
DB2.tbl1. Is there a way to do this?

Thanks,
Rich

May 16 '06 #2
Liz

"Rich" <Ri**@discussions.microsoft.com> wrote in message
news:7B**********************************@microsof t.com...
Hello,

I need to pull data from 2 tables that reside on the same sql server but 2
different databases. In Query Analyzer I can say this

select t1.*, t2.* from tbl1 t1 join database2.dbo.tbl1 t2 on t1.RecordID =
t2.RecordID

The .Net sql command object does not appear to support this kind of
syntax.


why not ? what does it do ?

May 16 '06 #3
I made a mistake. The sql command does support select t1.*, t2.* from tbl1
t1 join DB2.dbo.tbl1 t2 on t1.RecID = t2.RecID

My app works now.

"Liz" wrote:

"Rich" <Ri**@discussions.microsoft.com> wrote in message
news:7B**********************************@microsof t.com...
Hello,

I need to pull data from 2 tables that reside on the same sql server but 2
different databases. In Query Analyzer I can say this

select t1.*, t2.* from tbl1 t1 join database2.dbo.tbl1 t2 on t1.RecordID =
t2.RecordID

The .Net sql command object does not appear to support this kind of
syntax.


why not ? what does it do ?


May 16 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Pippen | last post by:
I'm currently working with a 10 million plus row database with the data residing on a Unix box with Cache 5.0. The problems is that it can take five days to pull one table from Cache to SQL 2000...
5
by: Julia Baresch | last post by:
Hi everyone, I haven't found any reference to this problem on this group or in Access 97 help. I hope someone here knows this - probably a simple thing, but not obvious. I designed a query to...
3
by: G rumpy O ld D uffer | last post by:
This is probably a 'Low-Level' question to all the ACCESS experts but I've only been using ACCESS for a couple of weeks. I've been given 30+ (and counting) separate 'Weekly' Databases which all...
1
by: David Sorber via AccessMonster.com | last post by:
Hello, I've got two questions. Im writing an Access 2000 database to collect data from multiple Visual Foxpro Databases, total some figures, save the data into a table for archiving purposes, and...
6
by: kenshiro | last post by:
Hi All, I'm having a problem with some VBA code in one of my Access 2003 databases. I'm getting the following error when running code behind a command button on a form: "Item not found in this...
6
by: gerbski | last post by:
Hi all, I am relatively new to ADO, but up to now I got things working the way I wanted. But now I've run into somethng really annoying. I am working in MS Access. I am using an Access...
2
by: Gummy | last post by:
Hello, I have a pretty large table (22,000 rows, 40 columns) that I need to return to either a webpage (maybe a datagrid or just a table) or just spit out directly to Excel. This table is coming...
5
by: Sam | last post by:
Hi, I have one table like : MyTable {field1, field2, startdate, enddate} I want to have the count of field1 between startdate and enddate, and the count of field2 where field2 = 1 between...
6
by: RoomfulExpress | last post by:
Here's the problem that I'm having- I'm trying to pull in 2 fields from my database and place them in the title of the HTML. I'm connecting to the db and selecting everything exactly the same as I am...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.