Beck
03-08-2003, 04:43 AM
The following chunk of VB Code is tested and totally runs on IE6+ on my local machine when there are no spaces in the database's directory. My question for the magic eight ball is, is there a JavaScript Equivalent? If so, does anyone either know it or know how I can go about researching (aka copy/pasting) it?
Thanks.
The VB Code:
path=Mid(Left(document.location,InStrRev(document.location, "/")) & "H6.mdb", 9)
' prewritten vbscript, courtesy of Dr. John
Dim rsH6 ' global recordset name
Dim objConn ' global connection object
Const adOpenKeyset = 1 ' ADO constants
Const adOpenDynamic = 2
Const adLockPessimistic = 2
Dim Conn ' connection string
Dim Query ' query string
set objConn = CreateObject("ADODB.Connection")
set rsH6 = CreateObject("ADODB.Recordset")
Conn = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Trim(path) & ";"
objConn.open Conn ' open connection
rsH6.CursorType = adOpenKeyset ' set cursor type
rsH6.LockType = adLockPessimistic ' set lock type
' list h6 sites in select form element for user selections
Query = "SELECT SiteID, SiteName, Address FROM H6" ' set the query to h6 sites
rsH6.open Query, objConn ' get record set from query
Do While Not rsH6.EOF ' loop through query
Set ObjEntry = document.createElement("OPTION") ' place each h6 site in select
objEntry.Text = rsH6.fields("SiteName") ' element for user access
objEntry.Value = rsH6.fields("SiteID")
selSites.Add objEntry
rsH6.MoveNext ' next h6 site
Loop
rsH6.close ' close query of h6 sites
' open access to user information in the database and prepare for login
'Query = "INSERT INTO [User] (UserID,PW,Role,SiteID) VALUES ('bob','bobpw','U','H02')"
Query = "SELECT UserID, SiteID, PW FROM [User]" ' set the query to users
rsH6.open Query, objConn ' get record set from query
Thanks.
The VB Code:
path=Mid(Left(document.location,InStrRev(document.location, "/")) & "H6.mdb", 9)
' prewritten vbscript, courtesy of Dr. John
Dim rsH6 ' global recordset name
Dim objConn ' global connection object
Const adOpenKeyset = 1 ' ADO constants
Const adOpenDynamic = 2
Const adLockPessimistic = 2
Dim Conn ' connection string
Dim Query ' query string
set objConn = CreateObject("ADODB.Connection")
set rsH6 = CreateObject("ADODB.Recordset")
Conn = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Trim(path) & ";"
objConn.open Conn ' open connection
rsH6.CursorType = adOpenKeyset ' set cursor type
rsH6.LockType = adLockPessimistic ' set lock type
' list h6 sites in select form element for user selections
Query = "SELECT SiteID, SiteName, Address FROM H6" ' set the query to h6 sites
rsH6.open Query, objConn ' get record set from query
Do While Not rsH6.EOF ' loop through query
Set ObjEntry = document.createElement("OPTION") ' place each h6 site in select
objEntry.Text = rsH6.fields("SiteName") ' element for user access
objEntry.Value = rsH6.fields("SiteID")
selSites.Add objEntry
rsH6.MoveNext ' next h6 site
Loop
rsH6.close ' close query of h6 sites
' open access to user information in the database and prepare for login
'Query = "INSERT INTO [User] (UserID,PW,Role,SiteID) VALUES ('bob','bobpw','U','H02')"
Query = "SELECT UserID, SiteID, PW FROM [User]" ' set the query to users
rsH6.open Query, objConn ' get record set from query