I usually use SqlConnection(connectionString) for a single connection
As I understand, an open SQLConnection will connect to a SQL instance rather than just a SQL database, which means you can perform query on all objects in all databases if you have sufficient permission, just like what you can do in Query Analyzer. Is this what you want? If yes, you can write your query using qualified object name:
select * from db1.dbo.tbl1 as t1 join db2.dbo.tbl2 as t2
on t1.id=t2.id
No comments:
Post a Comment