943,777 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 1822
  • VB.NET RSS
Oct 5th, 2007
0

establishing connection with more than one database

Expand Post »
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?????
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
nice_true is offline Offline
28 posts
since Sep 2007
Oct 5th, 2007
0

Re: establishing connection with more than one database

Click to Expand / Collapse  Quote originally posted by nice_true ...
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:
VB.NET Syntax (Toggle Plain Text)
  1. "SELECT a.dbo.emp.city, b.ado.emp.city FROM a.dbo.emp, b.dbo.emp"
Otherwise think of it this way:
VB.NET Syntax (Toggle Plain Text)
  1. "SELECT database1.dbo.table.column, database2.dbo.table.column FROM database1.dbo.table, database2.dbo.table"
Reputation Points: 43
Solved Threads: 68
Veteran Poster
SheSaidImaPregy is offline Offline
1,080 posts
since Sep 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: Duplicate print jobs using .NET
Next Thread in VB.NET Forum Timeline: Data Visualization requirement





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC