• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 137
  • Last Modified:

Designer question

I want the user to be able to switch databases without closing down the application, but when I try to switch databases I get an error telling me "operation is not allowed when object is open".  And when I go to debug it takes me to the code where I reassociate the dataenviroment with the new database - DataEnv.cnnDataEnv.ConnectionString = strConn. Any help with this would be greatly appreciated.  Thank you in advance.

Sam
0
Sam8932
Asked:
Sam8932
  • 2
1 Solution
 
Arthur_WoodCommented:
try this,Close the existing connection first:

DataEnv.cnnDataEnv.Close

then

assign the New connection string, and then re-open the new connection

DataEnv.cnnDataEnv.ConnectionString = strConn
DataEnv.cnnDataEnv.Open

Arthur Wood
0
 
Sam8932Author Commented:
Thanks Arthur,
I actually tried that already and it kind of works.  I don't get any errors, but the datacombo(I'm using DataEnv to populate it) doesn't populate when I switch databases.  Any ideas?
0
 
CleanupPingCommented:
Hi Sam8932,
This old question (QID 20563927) needs to be finalized -- accept an answer, split points, or get a refund.  Please see http://www.cityofangels.com/Experts/Closing.htm for information and options.
0
 
Arthur_WoodCommented:
try using the Requery method of the datacombo - just a guess, as I personnaly never use any of the bound controls.  All data handling is doen entirely in code.  Much easier to 'control' what happens and when.

AW
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now