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.<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><title>My First Dynamic HTML Page</title>
<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 collectionFor Each DiskDrive in Drives
DriveLetter = DiskDrive.DriveLetter DriveType = DiskDrive.DriveTypeif 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
'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()
</script></head><body>
<script language="VBScript"> if not Recordset1.Fields.Item("ColumnName").Value= "" then document.write(Recordset1.Fields.Item("ColumnName").Value) end if</script>
</body></html><script language="VBScript"> Recordset1.Close()</script>
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=123ProductID(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.)
If you see anything wrong or need help with something in this tutorial, give
me a shout.