Hi all,
I have some activeX code that I use to get the local computer name. (I don't
think this is possible using ASP from my research).
The rest of my code is ASP. I'd like to know how to pass the ActiveX
variable into my ASP script. My code is as follows. Thanks.
-----------------
activeX code: (I have this saved as activeX.asp which seems to work fine)
<Script language="vbscript">
Set oNetwork = CreateObject("WScript.Network")
sComputerName = oNetwork.ComputerName
</script>
-----------------
ASP code:
<% @ Language="VBScript" %>
<% Option Explicit
'declare your variables
dim connection
dim sSQL,sConnString
dim Username
If Request.ServerVariables("LOGON_USER") = "" Then
Response.Status = "401 access denied"
End If
Username=(Request.ServerVariables("LOGON_USER"))
'declare SQL statement that will query the database
'sSQL="INSERT INTO Log (FirstName, SurName) VALUES (Username, 'Wall')"
sSQL="INSERT INTO Log (Name) VALUES ('" & replace(Username,"'","''") & "')"
'define the connection string, specify database
' driver and the location of database
sConnString="DRIVER={Microsoft Access Driver (*.mdb)};" & _
"DBQ=" & Server.MapPath("ServerLog.mdb") & ";"
'create an ADO connection object
Set connection = Server.CreateObject("ADODB.Connection")
'Open the connection to the database
connection.Open(sConnString)
'execute the SQL
connection.execute(sSQL)
'check to see if there were any errors
If err.number=0 Then
response.write "the data was inserted successfully."
Else
response.write "there was a problem entering the data."
End If
'close the object and free up resources
Connection.Close
Set Connection = Nothing
%>