Skip to page content or Skip to Accesskey List.

Work

Main Page Content

Dynamic Websites On A Cd

Rated 3.57 (Ratings: 8)

Want more?

  • More articles in Code
 
Picture of rob.smith

Rob Smith

Member info

User since: 06 Nov 2002

Articles written: 1

Many people have asked how to do this over the years. Most solutions involved

a static presentation, which any novice can produce. I will attempt to illustrate

what it takes to bring your favorite dynamic website to your system, without

the big WWW... at all.

Stuff You Need

  • A CD writable drive to make the CD
  • CD writing software
  • Microsoft Access Database (97 preferrably. I'll explain why later)
  • Notepad or any another web page authoring tool
  • Knowledge of VBScript/ASP will do you good here

Let's Get Started

Assuming you, your computer, and any and all applications are ready to work...

  1. Start off by creating a Microsoft Access 97/2000 database.

    You can use a MS Access 2000 database but if you want greater compatibility

    to older systems such as Windows NT 4.0, 97 is the way to go. Just make

    sure you convert your database to 97 when you've finished modifying the

    2000 version.

  2. Next, you'll want to create your Dynamic HTML page.

    That's right. I said dynamic html page; no need to blink and/or rub your

    eyes. The following script will illustrate how to do so.

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

    <html>

    <head>

    <title>My First Dynamic HTML Page</title>

  3. Add CD-Rom detection script.

    You'll need this to determine the exact path to the actual database (which

    will be located on the CD-Rom). This information is vital for step 4. The

    code below will pick out the correct CD-Rom drive regardless if you place

    your CD in the 15th bay of a 31 bay CD-Rom drive tower. The code will break

    if there is an identical database name as yours in another CD-Rom drive.

    To avoid this, just name your database something completely unique.


    <script language="VBScript">

    'Declare variables used in this code

    Dim CD_Rom, FilePath, DriveLetter, DriveType, FileSystemObject, Drives

    'Create a filesystem object

    Set FileSystemObject = CreateObject("Scripting.FileSystemObject")

    Set Drives = FileSystemObject.Drives 'Create a drives collection

    For Each DiskDrive in Drives

       DriveLetter = DiskDrive.DriveLetter

       DriveType = DiskDrive.DriveType

       if DiskDrive.DriveType = "4" then

          CD_Rom = DiskDrive.DriveLetter

          FilePath = CD_Rom & ":\YourDataBase.mdb"

          Set FileSys = CreateObject("Scripting.FileSystemObject")

          If FileSys.FileExists(FilePath) then

             'This is the correct

    CD-Rom drive.

             Exit For

          else

             'Keep trying

          end if

       end if

    Next

    'Clean up data usage

    Set Drives = nothing

    Set FileSystemObject = nothing

    Set FileSys = nothing

  4. Add the DSN script

    If you want to connect to any database, you'll need a "vehicle" to

    do so. A DSN (Data Source Name) is just want the doctor ordered.

    'Declare variables used in this code

    Dim Recordset1

    Recordset1 = CreateObject("ADODB.Recordset")

    Recordset1.ActiveConnection = "Driver={Microsoft Access Driver (*.mdb)};Dbq=" & FilePath & ";Uid=admin;Pwd="

    Recordset1.Source = "SELECT * FROM YourTable WHERE Conditions=Exist"

    Recordset1.CursorType = 0

    Recordset1.CursorLocation = 2

    Recordset1.LockType = 3

    Recordset1.Open()

     
  5. Finish off the script

    </script>

    </head>

    <body>

     
  6. Write your dynamic code

    Use this script as often as you need throughout your newly created dynamic

    HTML page.

    <script language="VBScript">

       if not Recordset1.Fields.Item("ColumnName").Value

    = "" then

          document.write(Recordset1.Fields.Item("ColumnName").Value)

       end if

    </script>

     
  7. Finish your HTML page

    You'll also want to close your database connection as good housekeeping practice.

    </body>

    </html>

    <script language="VBScript">

    Recordset1.Close()

    </script>

     
  8. Other Things to Add If Needed

    You're probably thinking, ok so all this does is display information from

    a database. I want to use this page as a template for lots and lots of

    information. What if I want to send this page a Product ID number or other

    variables that should help me determine what information to display from

    my new database. Here's how...

    Add this somewhere before your database call in your <script></script> tags:

     Dim ProductID

    ProductID = split(Location.href, "=")

    Then down in your database call add as part of your where clause:


     "... WHERE ProductID = " & ProductID(1) 

    When you used the split function above, you in essense created

    an array of variables. Product(0) contains your variable name like "ProductID".

    Product(1) should contain the actual number you wanted. For example, if you

    wanted to reference this page by:

    thispage.htm?ProductID=123

    ProductID(1) will contain the number 123. Since everything starts numbering

    at 0 :-) you can reference all your variables in your query string by referencing

    the odd numbers (i.e. ProductID(1), ProductID(3), etc.)

     
  9. Burn Away!

    Pay close attention to Step 3 in regards to where you should place your database

    on the CD-Rom. Currently the code should work if the database is on the

    root directory of the CD-Rom. If it resides elsehwere, just change the

    code to parallel your changes.

If you see anything wrong or need help with something in this tutorial, give

me a shout.

About Azurite Design( visit site - I have other tutorials there too. )

Robbie Smith founded Azurite Design in 2002. This consultancy started out as helping friends and family get small personal web sites up. One of the most recent ones include Freelance College. You can see what he did in the Case Study.

The business grew slowly but steadily. Azurite Design targets small business owners who want a web presence or need help improving a current design. Azurite Design does not believe in charging exuberant gobs of money for the simplest details. We believe that our prices are very competitive and reasonable.

Azurite Design Specializes in back end programming and coding. Together, we can accomplish: Web Design, add back-end database management, capitalize on cd-rom catalogs, explore eCommerce, discover data warehousing, investigate Intranets, examine Extranets, master mailing lists, and search surveys. We test all our products for consistency and accuracy across all computing platforms, and all available current browsers.

Give us a call at 830-625-4276 or email us and together, we'll do whatever your heart desires or do whatever it takes to get you there.


Educational Experience

Robbie received a Bachelor of Science in Computer Science in 2001 from Texas State University with a minor in Mathematics. On a humorous note, his Calculus III class did not make due to lack of of interest.

He is now in the middle of a Masters in Information Systems Management from Keller Graduate School of Business Management through DeVry University. His coursework includes:

Accounting and Finance
Managerial Use and Analysis
Leadership and Organizational Behavior
Managing Organizational Change
Systems Analysis, Planning and Control
Database Concepts
Strategic Management of Technology
Database Applications for Electronic Commerce
Client/Server Applications
Networking Concepts and Applications
E-Business Security
Visual Basic
Internet Oriented Programming
Project Management Systems
Advanced Program Management
Overall GPA: 3.75 (after 8 courses)


Staff

President and Founder - Robbie Smith

Robbie, or Rob as he likes his friends (i.e. You) to call him by, started experimenting with computers and the Internet at the young age of 14 using SimpleText on an old Macintosh Quadra 630. In case you don't know of this computer, it was the last computer Macintosh ever made that didn't include the CD drive as a required item. He purchased a blazingly fast 4x speed drive a few months later seeing the demand grow.

The very next day after High School, he ventured off into college; didn't even take the summer off. He studied at Texas State University. Four years later, a Bachelor of Science in Computer Science, and one very cool Disney Internship, he went into the world.

Two years had passed working in the trenches and learning the ropes of the corporate environment, the hunger for education kept reappearing. He was accepted into the Keller Graduate School of Business Management to pursue an MISM (Masters of Information Systems Management). He's half way through the program and has earned a 3.75 GPA after 8 classes.

Wife and Assistant - Ilana Smith

Ilana (pronounced e-lawn-a), grew up in Delmas South Africa. She met Rob on the Disney Internship and got married 10 months later. She loves to bird watch and study biology. She has a degree in Wildlife Management with an Honors degree in Zoology.

Santa's Little Helper - Savana Smith

Currently, Savana is a little fire ball. She has 6 teeth and loves to blow rasberries on everything. It really tickles on the stomach. When she can, she'll have a career here if she so chooses.

The access keys for this page are: ALT (Control on a Mac) plus:

evolt.org Evolt.org is an all-volunteer resource for web developers made up of a discussion list, a browser archive, and member-submitted articles. This article is the property of its author, please do not redistribute or use elsewhere without checking with the author.