User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the VB.NET section within the Software Development category of DaniWeb, a massive community of 456,533 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,886 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our VB.NET advertiser: Programming Forums
Views: 836 | Replies: 1
Reply
Join Date: Sep 2007
Posts: 23
Reputation: nice_true is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
nice_true nice_true is offline Offline
Newbie Poster

establishing connection with more than one database

  #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?????
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Sep 2007
Posts: 1,058
Reputation: SheSaidImaPregy is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 61
SheSaidImaPregy SheSaidImaPregy is offline Offline
Veteran Poster

Re: establishing connection with more than one database

  #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:
"SELECT a.dbo.emp.city, b.ado.emp.city FROM a.dbo.emp, b.dbo.emp"
Otherwise think of it this way:
"SELECT database1.dbo.table.column, database2.dbo.table.column FROM database1.dbo.table, database2.dbo.table"
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb VB.NET Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the VB.NET Forum

All times are GMT -4. The time now is 4:37 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC