I do face a rather strange behavior at customer site:
My ASP.NET application tries to connect to a database using a connection string, specified in the web.config.
This works fine in all cases but one - this specific customer needed to switch integrated security on, due to security permissions. Strangely, now the application tries to connect to another database and not the one defined as 'initial catalog'.
I've already double-checked the connection string for any typos.
There are no USE statements in the queries. Basically there's nothing else telling the application where to connect to but this connection string.
If relevant - it is using the EntityClient provider.
The connection string (some parts changed of course):
<add name="ConnName" connectionString="metadata=... provider connection string="data source=SERVER;initial catalog=DB;persist security info=True;Integrated Security=true;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
Problem solved - there is a View involved which hasn't been created correctly and was pointing to that other database.