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

  • Home
  • SEARCH
  • 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 8248695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T23:16:41+00:00 2026-06-07T23:16:41+00:00

I have two databases with the same schema inside a Sql 2008 R2 Server,

  • 0

I have two databases with the same schema inside a Sql 2008 R2 Server, of which names are Database1 and Database2. I connected and performed queries on the Database1, and then changed to Database2 to fetch my entities using the following code

this.ConnectionString = "Server=TestServer; Database=Database2;Trusted_Connection=true";
using (IDataAccessAdapter adapter = new DataAccessAdapter(this.ConnectionString))
            {
                var entities = new EntityCollection<T>();
                adapter.FetchEntityCollection(entities, null);
                return entities;
            }

(The connection string was set before executing the code).

I debugged the application and looked at the value of the connection string, it pointed to the Database2.

However, when I executed the above code, the result was return from the Database1. And if I looked at SQL Profiler, the statement was executed against Database1.

So, could anyone know what was going on? Why the query was executed against the Database1, not Database2.

PS: If I used the above connection string with plain ADO.NET, I was able to retrieve data from Database2.

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-06-07T23:16:43+00:00Added an answer on June 7, 2026 at 11:16 pm

    I have figured out what was going on. The reason was: by default LLBL Gen Pro uses fully qualified names like [database1].[dbo].[Customer] to access database objects, and the catalog is specified when generating entities. So you can’t access objects just by changing the connection string.
    Hence, to change to another database you have to override the default catalogue by using following code

     var adapter= new DataAccessAdapter(ConnectionString, false, 
                                     CatalogNameUsage.ForceName, DbName)
                                 {CommandTimeOut = TenMinutesTimeOut};
    

    More information can be found at the following link

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

Sidebar

Related Questions

I have two tables with the exact same schema in SQL Server 2008 Standard
I have two SQL Server (2000) databases. Both are used for the same project,
I have two SQL Server 2008 Enterprise databases (on two machines), and one of
I have same database schema on two different SQL servers 2008. I have one
I have a table and two databases which have the same table, but one
I have two databases on the same server. One db is newer than the
Given two MS SQL databases which are known to have identical schemas, how should
I have two SQL Server 2005 databases, one is for development and the other
I am working on project (VS2010 .NET) and have two SQL Server databases, Dev
i have two database A,B with same number of tables and schema in sql

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.