|
123456789101112131415161718192021222324252627282930313233 |
- <%
- ' This class encapsulates database access into one location, isolating database details from the rest of the app.
- ' Multiple databases can be handled in one of two ways:
- '
- ' Option 1. Use a single DAL_Class instance with separate public properties for each database.
- ' Ex: To access Orders use DAL.Orders and to access Employees use DAL.Employees.
- '
- ' Option 2. Use a separate DAL_Class instance for each database.
- ' Ex:
- ' dim OrdersDAL : set OrdersDAL = new DAL_Class
- ' OrdersDAL.ConnectionString = "..." <-- you would have to create this property to use this approach
- '
- ' If you only access one database it is easier to just set the global DAL singleton to an instance of the
- ' Database_Class and use it directly. See the example project for details.
-
- '=======================================================================================================================
- ' DATA ACCESS LAYER Class
- '=======================================================================================================================
- dim DAL__Singleton : set DAL__Singleton = Nothing
-
- Function DAL()
- If DAL__Singleton is Nothing then
- set DAL__Singleton = new Database_Class
- if dev = true Then
- DAL__Singleton.Initialize "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type=5;Data Source=" & Request.ServerVariables("APPL_PHYSICAL_PATH") & "Data\webdata - Copy.mdb;"
- Else
- DAL__Singleton.Initialize "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type=5;Data Source=C:\inetpub\Data\webdata - Copy.mdb;"
- 'DAL__Singleton.Initialize "Provider=SQLOLEDB;Server=danielsubuntu,15789;Database=tracking;UID=sa;PWD=SunBrightShine!;"
- End If
- End If
- set DAL = DAL__Singleton
- End Function
- %>
|