Hello,
I'm trying to test a clientside ado connection to update a db table when the client loads a page. After it is working I would encode the clientside script to protect the db connection from prying eyes.
I haven't messed with a dsn-less connection or ado connection in jscript I do them quite often in vbscript but I seem to be missing something in the code.
It generates a couple of errors like expected ; so I added them to the end of each line to try to correct it but no dice.
Anybody see what I missed?
Thanks, Danzig
I'm trying to test a clientside ado connection to update a db table when the client loads a page. After it is working I would encode the clientside script to protect the db connection from prying eyes.
I haven't messed with a dsn-less connection or ado connection in jscript I do them quite often in vbscript but I seem to be missing something in the code.
Code:
<html>
<head>
<script><!--
function updatedb() {
var ConnectSTR
var oRsNewData
var strSQL
objConn = new ActiveXObject("ADODB.Connection");
ConnectSTR = "driver=SQLServer;server=SQL_SERVER_NAME_GOES_HERE;uid=SQL_USERID_GOES_HERE;pwd=SQL_PASSWORD_GOES_HERE;database=SQL_DB_NAME_GOES_HERE;";
objConn.open ConnectSTR;
oRsNewData = new ActiveXObject("ADODB.Recordset");
strSQL = "INSERT INTO db_Connect (MachineName,UserID)VALUES('TestMachine','TestUser')";
objConn.Execute(strSQL);
}
--></script>
<title>JS ADO Update</title>
</head>
<body onload="updatedb()">
Updating The Database
</body>
</html>
It generates a couple of errors like expected ; so I added them to the end of each line to try to correct it but no dice.
Anybody see what I missed?
Thanks, Danzig