最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Asp调试存储过程
时间:2022-06-30 10:33:38 编辑:袖梨 来源:一聚教程网
asp开发bs架构的三层系统,对于中小结构的系统把业务逻辑放在sqlserver的存储过程里面是一个很好的实现方法,但这么做出现了一个asp客户端和数据库存储过程之间配合调试的不方便.
实际开发中我写了下面一个函数,自动把asp端传给数据库的参数取出,自动生成符合sqlserver查询分析器的规则的存储过程执行命令串,放在textarea控件里,可以从页面直接复制到查询分析器里进行存储过程调试,下面就是程序.
'==================================================================’
dim dsn '数据源
dim storename '存储过程名
dim con 'Connection对象
dim cmd 'Command对象
dim rs 'Recordset 对象
set con=server.createobject(“ADODB.Connection”)
con.open dsn
set cmd=server.createobject("ADODB.Command")
set cmd.ActiveConnection=Con
cmd.CommandText= storename
cmd.Commandtype=adCmdStoredProc
cmd.Parameters.Append cmd.CreateParameter("@State",adInteger,adParamInput,4)
cmd.Parameters.Append cmd.CreateParameter("@WhereT",adVarChar,adParamInput,200)
cmd.Parameters.Append cmd.CreateParameter("@BranchType",adVarChar,adParamInput,50)
cmd("@State") = 1
cmd("@WhereT")=”2”
cmd("@BranchType")=”3”
getpmt(cmd) '获取存储过程的参数
set rs=server.CreateObject("adodb.recordset")
rs.CursorType =3
rs.LockType =3
rs.CursorLocation =3
set rs.Source =cmd
rs.Open
'======================================================’
' 形成存储过程的函数
'=======================’
' 输入参数 a= command对象
'=======================’
sub getpmt(a)
b=a.CommandText
b=replace(b,"?","")
b=replace(b,",","")
b=replace(b,"}","")
b=replace(b,"{","")
b=replace(b," ","")
b=replace(b,"call","")
b=replace(b,"(","")
实际开发中我写了下面一个函数,自动把asp端传给数据库的参数取出,自动生成符合sqlserver查询分析器的规则的存储过程执行命令串,放在textarea控件里,可以从页面直接复制到查询分析器里进行存储过程调试,下面就是程序.
'==================================================================’
dim dsn '数据源
dim storename '存储过程名
dim con 'Connection对象
dim cmd 'Command对象
dim rs 'Recordset 对象
set con=server.createobject(“ADODB.Connection”)
con.open dsn
set cmd=server.createobject("ADODB.Command")
set cmd.ActiveConnection=Con
cmd.CommandText= storename
cmd.Commandtype=adCmdStoredProc
cmd.Parameters.Append cmd.CreateParameter("@State",adInteger,adParamInput,4)
cmd.Parameters.Append cmd.CreateParameter("@WhereT",adVarChar,adParamInput,200)
cmd.Parameters.Append cmd.CreateParameter("@BranchType",adVarChar,adParamInput,50)
cmd("@State") = 1
cmd("@WhereT")=”2”
cmd("@BranchType")=”3”
getpmt(cmd) '获取存储过程的参数
set rs=server.CreateObject("adodb.recordset")
rs.CursorType =3
rs.LockType =3
rs.CursorLocation =3
set rs.Source =cmd
rs.Open
'======================================================’
' 形成存储过程的函数
'=======================’
' 输入参数 a= command对象
'=======================’
sub getpmt(a)
b=a.CommandText
b=replace(b,"?","")
b=replace(b,",","")
b=replace(b,"}","")
b=replace(b,"{","")
b=replace(b," ","")
b=replace(b,"call","")
b=replace(b,"(","")
相关文章
- 多邻国官网登录入口-Duolingo官方网页版入口 01-18
- 啥都能看的视频神器-资源最全的视频神器 01-18
- 新浪微博网页版手机端-新浪微博手机版网页入口 01-18
- 夸克网页版-夸克浏览器网页版入口 01-18
- 动漫共和国入口_动漫共和国官网与分类导航 01-18
- 绝世唐门漫画完整免费入口在哪?2026最新免费观看地址及平台汇总 01-18