HELP HOW TO:
1. call a jscript function in ASP
2. perform record insertiion using jscript
i have this code running to execute insert sql cmd
<% @LANGUAGE="jscript" %>
<%
//open dns connection
var strcon="DSNName";
ocon=Server.CreateObject("ADODB.Connection");
ocon.Open(strcon);
//run execute command to insert new record
ocon.execute("INSERT INTO tblname(fld1,fld2,...) VALUES(val1,val2,...);");
ocon.close();
%>
now since this code is running as ASP file
im planning to encapsulate the codes to a function and trigger a function call from
other page where is it will execute record insertion. i rewrite the code to this:
<% @LANGUAGE="jscript" %>
<%
function add(){
//open dns connection
var strcon="DSNName";
ocon=Server.CreateObject("ADODB.Connection");
ocon.Open(strcon);
//run execute command to insert new record
ocon.execute("INSERT INTO tblname(fld1,fld2,...) VALUES(val1,val2,...);");
ocon.close();
}
%>
but an error return...