几例在ASP数据库存储过程的使用方法
Create Procedure Returnemploy
AS
select emp_id, fname from employee
If Exists(Select fname From employee Where fname=''Margaret'')
Return(1)
Else
Return(0)
例wuf73.asp
<% @LANGUAGE = VBScript %>
<!--#include file="AdoSQL7.asp"-->
<!--#include file="adovbs.inc"-->
<% '' wuf73.asp
Dim cmdTest, prmTest, rsTest
Set cmdTest = Server.CreateObject("ADODB.Command")
cmdTest.ActiveConnection = Cnn
cmdTest.CommandText = "Returnemploy" ''存储过程名
cmdTest.CommandType = adCmdStoredProc
内容来自dedecms
Set prmTest = cmdTest.CreateParameter("ReturnValue",adInteger,adParamReturnValue)
织梦内容管理系统
cmdTest.Parameters.Append prmTest
Set rsTest = cmdTest.Execute()
内容来自dedecms
While Not rsTest.EOF
Response.Write rsTest(0) & " ][ " & rsTest(1) & "<br>"
rsTest.MoveNext
Wend
rsTest.Close: Set rsTest = Nothing
织梦内容管理系统
''返回 cmdtest("ReturnValue") 之前,必须先关闭rsTest, 否则结果错误
If cmdtest("ReturnValue") = 1 Then
Response.Write "有该雇员"
Else
织梦好,好织梦
Response.Write "无该雇员"
文章评论
共有位Admini5网友发表了评论 查看完整内容