Using C#, Windows Forms app, VS Pro 2005 edition:
I moved my app's backend SQL Server Express database to the main server. The dataset/tableadapter/binding names that were automatically generated using my local PC SQL Server data source are now not the same as the server datasource.
For example, my old dataset name is "myDataSet", and the new one is myNewDataSet". Ditto tableadapters. (OK, they aren't actually named "my...", but you get the idea).
The database structure, etc is identical. The new server-based datasource was generated in Visual Studio OK, and all the tables, views, etc work fine.
Is there an easy way to 'point' the app to the new database without totally rewriting it I tried changing one form's datasource to the new dataset, but there's so much code behind the form that refers to the old dataset/tableadapters that it didn't work. I also tried renaming all of the old dataset/adapter names to the new one and that blew up.
What I want to do is simply tell the darn thing that the source DB is the new one, and continue using all of the present logic/code/etc..
I also want to allow the use/selection of either the main production DB, or a Development DB on the same server - so names will change depending.
Thanks,
G.

Moved DB to Server - do I have to recompile and change all of the dataSet Names??
Gary B
I think the theory is all you need to do is change the connectionstring property in the app.config file. So you don't need to modify anything to point the application to a different SQL Server and database, all you need to do is modify the
Here is a sample app.config for example, I would just change the connectionString portion of this and deploy with app ->
< xml version="1.0" encoding="utf-8" >
<configuration>
<configSections>
</configSections>
<connectionStrings>
<add name="DataSourceTest.Properties.Settings.tdsConnectionString"
connectionString="Data Source=MyServer\MyInstance;Initial Catalog=MyDatabase;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>
JackDanielsDrinker
It sounds like the old datasource/connection string is hard coded in a lot of places.
My suggestion...Ctrl + f and replace all old with new.
Outside of that, good luck :)
Adamus
Jdjr2
Thanks,
The appconfig file has both the old and the new data sources. Mine reads:
<
connectionStrings>// This is the original data source for the local PC SQL Server
<
add name="DT2.Properties.Settings.csDT2" connectionString="Data Source=WDC;Initial Catalog=OldDataSource;Integrated Security=True" providerName="System.Data.SqlClient" />// The next line is the new, desired, source for the LAN Server
<add name="DT2.Properties.Settings.DrilTracR" connectionString="Data Source=CHANDLER1\CHANDLER1;Initial Catalog=NewDataSource;Integrated Security=True"
providerName="System.Data.SqlClient" /></
connectionStrings>The problem is that all of the datasets, tableadapters, and bindings use the OldDataSource name embedded in thier names. For example, the old dataset name would be oldDataSourceDataSet.
With both of the data sources in the appconfig file, how do I get the app to use the new data source, and secondly, how do I get all of the datasets, adapters, etc to use the new data source
Thanks
G.
James Juno
I tried adding the new data source and commenting out the old data source in the App.config file. The program still uses the old data source! Must be referencing it from some other place.
Any clues
Thanks
G.
Amr Noureldin
The connection string was created by VS and I haven't done any custom coding.
I did find a cludge that works with simple apps:
Configure each table's TableAdapter to use the new connection as the data source (and regen the SQL Fill(), etc. methods). When tried with my app, which contains three dozen tables, I get the tables to update the new datasource, but it draws data from the old source. Interesting.
Gotta be an easy way....
How do people do it when developing on a local PC and porting over to a server
Thanks
G.