tags:

views:

39

answers:

2

I have an archive system that had to be on two sql databases for simplicity

one is
Archive2009
and the other Archive2010

they are both on the same sql server and instance and have identical structures however I have a page that needs to view the old one and the new one (I can make two seperate pages)

How best would I go about doing this? Dynamically changing the connection string etc?

A: 

You probably best use two Linq-to-SQL data contexts, e.g. one for Archive2009 and the other for Archive2010. That way, each of the data contexts is dealing with just a single database and you can select stuff from both data contexts at the same time.

marc_s
But then I get type name conflictsAmbiguity between 'arc.id' and 'arc.id' \NewArchive.aspx.cs
Hurricanepkt
can you put them into separate namespaces?? Archive2009.DataContext vs. Archive2010.DataContext or something like that?? You can specify the namespace for the generated classes on the DBML design surface, in its properties window.
marc_s
A: 

If you are accessing these databases via L2S, then you'll probably want a DBML that points to Archive2009, and a DBML that points to Archive2010. Then your queries can use whichever DBML is appropriate. If you run into namespace issues, use different generated namespaces for each DBML.

Randy Minder