Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Using Two DataSets on One Windows Form

Author  Topic 

LHendren
Starting Member

17 Posts

Posted - 2010-07-22 : 12:02:35
SQL 2005 Server, Visual Studio 2010

I have a company financial Database named ESS developed by Microsoft and a reporting Database named LIMS developed by me. Both are in Microsoft SQL databases.

On my windows form, I want to access the LIMS data we generate internally along with the customer records held in the ESS data.

With the New DataSources wizard, I can create connection strings with Initial Catalog = ESS as ESSDataSet. Likewise, I can create connection strings with Initial Catalog = LIMS as LIMSDataSet. I have created many web pages and forms with each of the datasets independently, but never combined.

In dBase, I combined both databases into a DataModule. Is there a way to combine in SQL?

Bustaz Kool
Master Smack Fu Yak Hacker

1834 Posts

Posted - 2010-07-22 : 14:13:20
If the two databases are on the same SQL Server, you can reference one from the other by using a more qualified name. for instance, to access a table in LIMS from the ESS database:[CODE]
SELECT *
FROM LIMS.dbo.MyTable[/CODE]This does assume that the User on ESS has the appropriate rights GRANTED in the LIMS database.

If the databases are on different servers, you can establish a Linked Server configuration and then use a fully qualified name for the object (table) desired. A fully qualified name has four parts: Server.Database.schema.Object

=======================================
A couple of months in the laboratory can save a couple of hours in the library. -Frank H. Westheimer, chemistry professor (1912-2007)
Go to Top of Page
   

- Advertisement -