可能要Jscript Version 5以上
<SCRIPT RUNAT=SERVER Language=javascript> var oConn; var Rs; var empID=3; var err_flag; //错误旗标 try { oConn = Server.CreateObject("ADODB.Connection"); oConn.Open("DSN=sybase1;uid=sa;pwd=;database=mydatabase");
Rs=oConn.Execute ( " Select * from Operator_Info where Op_ID="+ empID +"" ); } catch(e){ //如果有错 err_flag=1 print(e) } finally { if (!err_flag) Response.Write ("successfully") else Response.Write ("failed") }
function print(s){ Response.Write(s+"<br>"); }
</script>
|