Suntower
Posts: 225
|
| Posted: 02/16/2007, 8:20 AM |
|
Hi,
We have a site which we would like to keep as a single site, BUT we want it to connect to different databases depending on the start page. This is because users will be accessing from different countries. What we want is for the opening page to process a parameter and then dynamically switch from one database to another depending on this parameter. The databases are IDENTICAL in structure so the only thing that needs to change is the connectionstring.
Is there a way to -dynamically- change this connection string at the start page so that it will work with multiple tables? I see where I can change the global connection string built by CCS, but I'm wondering if there aren't other 'gotchas' under the hood.
Thanks in advance,
---JC
_________________
---On a campaign for more examples and better docs! |
 |
 |
Benjamin Krajmalnik
|
| Posted: 02/16/2007, 1:42 PM |
|
Should work ok.
You can hand modify the generated code to become dynamic in nature.
|
|
|
 |
Suntower
Posts: 225
|
| Posted: 03/02/2007, 11:19 AM |
|
Quote Benjamin Krajmalnik:
Should work ok.
You can hand modify the generated code to become dynamic in nature.
Hi Benjamin,
Any thoughts on how I would do this -without- having to hand-edit COMMON.ASP every time I edit the project? IOW: It seems that the relevant code is in a private subroutine inside the clsDBConnection class.
Private Sub Class_Initialize()
ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=whatever;Initial Catalog=whatever;Data Source=SUNTOWER-TESTSERVER"
User = "test"
Password = "testpassword"
Set Converter = New clsConverter
Converter.DateFormat = Array("yyyy", "-", "mm", "-", "dd", " ", "HH", ":", "nn", ":", "ss")
Converter.BooleanFormat = Array(1, 0, Empty)
Set objConnection = Server.CreateObject("ADODB.Connection")
Database = "MSSQLServer"
Set Errors = New clsErrors
End Sub
How can I change the connection string 'on the fly' if there are no events in there to communicate with the outside world? Sure I can hand code this, but since CCS generates a new COMMON.ASP, wouldn't I have to re-edit this -every- time I published the project?
---JC
_________________
---On a campaign for more examples and better docs! |
 |
 |
Suntower
Posts: 225
|
| Posted: 03/02/2007, 11:30 AM |
|
To add to it... Should I be asking...
Since the subroutine Class_Initialize is private, is there a way I can change the code generator to use variables for ConnectionString, User and Password?
Is -that- the question I should be asking?
---JC
_________________
---On a campaign for more examples and better docs! |
 |
 |
|