Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Feb 02, 2013 02:24 AM by Decker Dong - MSFT
Jan 31, 2013 09:04 PM|LINK
Hi All: weird problem...I have a development SQL Server with a database, and a production SQL server with a different database.
In my web.config, I have a connection string defined with the development credentials (using system.data.sqlclient and SQL login/pwd)
I have a transform for my web.config for the live server, with a different connection string.
In my project, I have a strongly-typed dataset created in VS2010 with the dataset designer. I have a tableAdapter with sql statement that loads a particular table, and a separate queriesTableAdapter that invokes some stored procedures to insert/update etc.
into that table.
When I publish to the live server, the connection string is correctly transformed, and I can load a page that uses the tableadapter to display a specific record from the table. I have a button in the page that on postback, initializes the queriesTableAdapter
and calls one of the stored procedures.
When on the live server I hit the button to invoke the SProc, I get an error:
System.Data.SqlClient.SqlException: Invalid object name 'devServerDB.dbo.company'.
where the object name refers to the development database name instead of the live database name. When I check the web.config
on the live server, the connection string is correctly referencing the live server's dB name.
It seems, however, the dataset is not loading the correct (i.e. transformed) connection string from the web.config...or it's caching the database name somehow ...but only for the stored procedures in the queriesTableAdapter, not the tableAdapter that loads
I have the same sort of project structure on literally dozens of other websites, and this is the only time I've seen a dataset behave this way?
Jan 31, 2013 10:02 PM|LINK
To debug, I created a new dataset using the same table and stored procedures, and it still exhibited the same behavior on the live website (referencing the wrong database name).
I then duplicated the existing database on the live server to a new database with the same name as the database on the development server, and everything is working...
what's weird is I have other projects where the development and live databases have different names, but this problem does not occur?
Feb 02, 2013 02:24 AM|LINK
Have you enabled Cache?
Can you show us your full codes of your aspx and cs ones?