Forum Moderators: open
But once inside the app, should every single call to a business component pass a connection string? like this .
objCustomer.Update("Joe Bloggs", 2,2,3, strConn)
It seems a bit strange to do it this way as the business componets are usually specific to 1 app, and so at most have 3 databases - test/staging/live. But an easy way is needed to switch without recompiling.
COM encourages writing stateless components so where should the connection be stored and when should it be set.
As for where to store it, an encrypted string in an INI file then decrypting it on the fly works well. You can also use the registry to store it but one would prefer access to the registry be restricted.