CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 Dynamic Database Connection

Print topic Send  topic

Author Message
kevind

Posts: 251
Posted: 11/28/2008, 11:16 AM

:(

I want to develop one application where the user logs in and based on that the application connects them to their 'dataset' which is an MS Access database of their data only.

There will be a common login database connection and a (i guess) database connection string table in that database to use to change the connection to their data.

I don't want to have 4 different paths to 4 identical web apps, nor do i want to filter the data to their companyID (which I can and am doing now). I want to just make sure that the data is physically partitioned in files, not just in code and that i only have to maintain one web app.

can anyone point me to an article dealing with this issue?

thanks
Kevin

_________________
thanks
Kevin

======================
CCS 3.2.x / ASP / MS Access /mySQL / PHP / jQuery / jQuery UI / jQuery Mobile
View profile  Send private message
dataobjx


Posts: 181
Posted: 02/21/2009, 6:42 AM

This could be a bit tricky - I've looked into it in the past, but subsequently didn't need to try it as the requirements had changed.
Having said that... it should work, but I cannot guarantee it.

But, if you are going to try this, here's where you start.

Your entry point to the application sounds like the initial login to a common database.
Create a session variable called ConnectionString.
'initialize the connection string with the connection string to the common login database
'Create this in the before show event of the login page
E.g., Session("ConnectionString") = "Provider=X;Persist Security Info=False;User ID=Xr;Initial Catalog=X;Data Source=X"

If the login succeeds, you want the common database to pass you the say, the connection string to one of the other mdb files.
Perform a CCDLookup assuming you have a field in the common login database called "CNString" after the login succeeds.

E.g., Session("ConnectionString") = CCDLookup("CNString", "TableName", ID=" & Session("UserID"))

Now, the Session("ConnectionString") is pointing to one of the other databases and your application performs a redirect to the page where the work begins.

Now this isn't really recommended, but you need to modify common.asp

The reason it's not recommended is because one has to remember (when one upgrades CCS) to copy that code out, regenerate using the new version of CCS and then paste the code back into the new common.asp file. It may even be regenerated each time you compile in which case you need to make the file read-only and then click the skip button when a compile attempts to overwrite it.

Within the common.asp file locate the following function;

Private Sub Class_Initialize()
ConnectionString = "Provider=X;Persist Security Info=False;User ID=Xr;Initial Catalog=X;Data Source=X"
....
End Sub

Modify it using logic - something like this;

Private Sub Class_Initialize()
ConnectionString = Session("ConnectionString")
End Sub

Like I said, it's not recommended but this is the entry point to perform such an action.
_________________
www.DataObjx.net
www.mydigitalapps.com
View profile  Send private message
Oper


Posts: 1195
Posted: 02/23/2009, 8:29 PM

here is another approach without changing grey part of CCS.

http://www.informatica.com.do/ContentComent.asp?cid=50

(also is our first approach using Artisteer)

Note its in spanish. but easy to follow, we are trying to compilate trick for CSS and other stuff too.
_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)

http://www.PremiumWebTemplate.com
Affiliation Web Site Templates

Please do backup first
View profile  Send private message
kevind

Posts: 251
Posted: 02/24/2009, 4:28 PM

Very interesting approach Oper.

I will try that when I get back to that project - it looks very smooth.

Kevin
_________________
thanks
Kevin

======================
CCS 3.2.x / ASP / MS Access /mySQL / PHP / jQuery / jQuery UI / jQuery Mobile
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.