establishing connection with more than one database

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Sep 2007
Posts: 28
Reputation: nice_true is an unknown quantity at this point 
Solved Threads: 0
nice_true nice_true is offline Offline
Light Poster

establishing connection with more than one database

 
0
  #1
Oct 5th, 2007
Hi!

I wish to specify more than one databases in my connection string in a vb.net project, in order to retrieve records from both of them.


For example,

I have 2 databases , database A and database B


I wish to retrieve the city field from the emp tables of both of them, like this


select a.dbo.emp.city from a.dbo.emp union select b.dbo.emp.city from b.dbo.emp


How is this possible?????
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 1,080
Reputation: SheSaidImaPregy is an unknown quantity at this point 
Solved Threads: 68
SheSaidImaPregy SheSaidImaPregy is offline Offline
Veteran Poster

Re: establishing connection with more than one database

 
0
  #2
Oct 5th, 2007
Originally Posted by nice_true View Post
I wish to retrieve the city field from the emp tables of both of them, like this
select a.dbo.emp.city from a.dbo.emp union select b.dbo.emp.city from b.dbo.emp
How is this possible?????
Well first, this is more of an SQL question. But anyway, just do it this way following your syntax:
  1. "SELECT a.dbo.emp.city, b.ado.emp.city FROM a.dbo.emp, b.dbo.emp"
Otherwise think of it this way:
  1. "SELECT database1.dbo.table.column, database2.dbo.table.column FROM database1.dbo.table, database2.dbo.table"
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC