Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6144857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:42:35+00:00 2026-05-23T18:42:35+00:00

I successfully retrieved data from an already populated table of a live database using

  • 0

I successfully retrieved data from an already populated table of a live database using mvc3 and linq 2 SQL. The table is defined in the DataClasses1.dbml.

Now I have to retrieve data from other tables with the same identical structure of DataClasses1 but from different databases on the same SQL Server( DB1.Customers DB2.Customers ecc), and display them grouped by database name.

1) How can I do that without creating N DataClassesN.dbml ? I guess since it’s the same table structure I can avoid doing it.

2) (Optional): How can I automatically retrieve data also from tables of new created databases?

3) (Not relevant): How can I define a strongly type view? Seems I can do it using EF but I cannot do it using LINQ 2 SQL.

  • I already thought of creating a view on the database with all the customers tables, but it seems it’s a too heavy view!

  • I have a query that returns all the database names (Select name from master..syttables), is it useful?

Thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T18:42:35+00:00Added an answer on May 23, 2026 at 6:42 pm

    You just pass a different connection string to the data context when you create it. If the databases are truly identical, including all the foreign key relationships, then just do something like:

    var dc = new DataClasses1(db1connectionstring);
    // Do your display of database 1 data
    var dc2 = new DataClasses1(db2connectionstring);
    // Do your display of database 2 data
    

    I have no idea what you mean by #2. Data doesn’t retrieve itself.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can run LINQ queries successfully to retrieve data from OData providers. I'm not
So I successfully retrieved my BLOB image from the database and set it to
I have successfully connected to an Oracle database (10g) from C# (Visual Studio 2008)
I have some XML data retrieved from a web service that I use to
I am trying to fetch a row from a table in my database, and
I can successfully retrieve data asynchronously through NSURLConnection from any other part in the
Setup: I have a custom class I've created that handles data retrieved from a
Okay, so I have successfully retrieved rows from my db where i have fields
I created a simple wcf service that retrieves data from crm 4.0 using the
I'm using curl to retrieve information from wikipedia. So far I've been successful in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.