Can anybody tell me how to change database connection from one MSSQL database to another? I change the connection string in ConnectionManager.Connections[i].ConnectionString,
clear the ConnectionPool and deactivate/activate all data tables, but when I try to access data on all tables it still points to the old database, instead of the new one (I know, because of the different data in those databases). Debug shows that the connection string was updated with the new data.
The only thing that works 100% is an application restart. This is a DataAbstract/RemObjects SDK service application, so restart is not really an option.
I have tried it just now, but it did not help. Added code to clear the data adapter serviceInstance to the Stop() procedure, but it still connects to the old database.
Ok, I see the problem now. I placed “ServiceInstance := nil;” after all other lines. When I moved it before “ClearPool”, it started working.
Thank you.