栏目导航
热点推荐
- ASP下批量删除数据的两种方法
- 关于二级域名共享cookies
- ASP错误代码大全
- ASP代码实现show.asp?id=26变成s
- ASP错误信息解决:IIS启用父路径
- 一些常用的正则表达式大全
- ASP超级链接和HTML函数正则表达
- ASP隐藏下载地址及防盗代码
- 最常用的正则表达式示例
- ASP程序数据库被挂马的处理方法
- ASP生成html的新方法
- 精通ASP错误提示大全
阅览排行
ASP访问带多个参数的存储过程
www.jz123.cn 2008-11-01 来源: 中国建站 袁袁整理 我要投递新闻
1.ACCESS
查询(query_info):
select * from info where stu = name1 and age = age1
ASP代码:
以下为引用的内容:
Dim conn,comm,rs
Set conn = Server.CreateObject("ADODB.Connection")
Set comm = Server.CreateObject("ADODB.Command")
conn.open "Driver={Microsoft Access Driver (*.mdb)};Dbq=" & Server.MapPath("db1.mdb")
comm.Parameters.Append comm.CreateParameter("name1",200,1,100,"张三")
comm.Parameters.Append comm.CreateParameter("age1",200,1,100,"25")
comm.ActiveConnection = conn
comm.CommandType = 4
comm.CommandText = "query_info"
Set rs = comm.Execute
If not rs.eof Then
Response.Write(rs(1))
End if
Set rs = nothing
Set comm = nothing
conn.close
Set conn = nothing
2.SQL Server:
存储过程(query_info):
以下为引用的内容:
@name1 varchar(20) ="张三",
@age1 int = 25
AS
Select * from info where stu=@name1 and age = @age1
GO
ASP代码:
以下为引用的内容:
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.open "Driver={SQL Server};server=(local);uid=sa;pwd=txwl006;database=tempdb;"
Set objComm = Server.CreateObject("adodb.command")
objComm.Parameters.append objComm.CreateParameter("@name1",200,1,50,"李四")
objComm.Parameters.append objComm.CreateParameter("@age1",200,1,50,32)
objComm.CommandType = 4
objComm.ActiveConnection = objConn
objComm.CommandText = "query_info"
Set objRs = objComm.execute
If not objRs.eof Then
Response.write objRs(1)
End if
Set objRs = Nothing
Set objComm = Nothing
objConn.close
Set objConn = nothing
上一篇:用ASP和SQL语句动态的创建Access表 下一篇:ASP程序漏洞解析及黑客入侵防范方法