[求助]请您讲解如何触发VBScript中自定义函数的问题
我想用这两个函数实现记录的显示和添加,但是不知道如何用按钮的单击事件来响应,请您帮忙,谢谢!!!<script language="VBScript">
Function Add()
Dim conn,connString,rs,li,name,pwd
connString="Driver={SQL Server};Server=(local);Database=cao;uid=cao;pwd=cao"
Set conn=Server.CreateObject("ADODB.Connection")
Set rs=Server.CreateObject("ADODB.RecordSet")
name=Request.Form("name")
pwd=Request.Form("pwd")
sql="select * from login"
conn.open connString
rs.open sql,conn,3,2
rs.AddNew
rs("username")=name
rs("userpasswd")=pwd
rs.Update
rs.close
conn.close
Set conn=Nothing
Set rs=Nothing
End Function
Function Find()
Dim conn,connString,rs,li
connString="Driver={SQL Server};Server=(local);Database=cao;uid=cao;pwd=cao"
Set conn=Server.CreateObject("ADODB.Connection")
Set rs=Server.CreateObject("ADODB.RecordSet")
sql="select * from login"
conn.open connString
rs.open sql,conn,3,1
Do while Not rs.eof
Response.write rs.fields("username")
Response.write rs.fields("userpasswd")
Response.write "<br>"
rs.movenext
Loop
rs.close
conn.close
Set conn=Nothing
Set rs=Nothing
End Function
</script>
<body>
<input type="button" name="find" value="查询" onclick="Find()">
</body>