Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Clientside ADO Connection

Status
Not open for further replies.

DANZIG

Technical User
Mar 8, 2001
142
US
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.

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
 
that code worked fine for me(when i commented the execute stmts)...

Known is handfull, Unknown is worldfull
 
I get a Javascript Error- object not found-- any ideas?? This could be very useful I was trying to do this...

Thanks,
Lisa
 
is ADODB installed in ur system???

Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top