|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
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 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! Show quoteHide quote "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 > > "Rich" <R***@discussions.microsoft.com> wrote in message why not ? what does it do ?news:7BE0B3AE-F158-4D43-91A7-450341EE6869@microsoft.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. 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. Show quoteHide quote "Liz" wrote: > > "Rich" <R***@discussions.microsoft.com> wrote in message > news:7BE0B3AE-F158-4D43-91A7-450341EE6869@microsoft.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 ? > > > > > >
Byte to Chr - not correctly translated!!
GetDefaultPrinter Saving a JPG from the web to local disk VB.NET Windows Service Question (Timing) How Do I Put An End Of Line Character In A TextBox User Software Settings and System Software Settings in Windows Regsitry .NET Remoting String Name to a User Control? Confusion over namespaces CSV file reading every other record... |
|||||||||||||||||||||||