谁能给个完整的存储过程的asp(sql)例子给我

areslong 2006-06-27 11:39:17
数据库在本地,用户名sjk;密码123456;数据库是myyp;
要显示的表名city;字段id(int),name(nvarchar),zip(nvarchar)
在网上找了好几篇文章,可不是这错就是那错,那位老大帮我弄个完整点的啊(sql的存储过程,asp的调用)谢谢了!!!
...全文
262 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
oowingoo 2006-08-17
  • 打赏
  • 举报
回复
标记,学习
kagomelee 2006-08-08
  • 打赏
  • 举报
回复
学习 标记
addwing 2006-06-27
  • 打赏
  • 举报
回复
关注。学习
ice241018 2006-06-27
  • 打赏
  • 举报
回复
调用存储过程:
<%
dim name,pass
name = Request.Form("name")
pass = Request.Form("pass")

dim con, conn, strSQL
con = "Provider=SQLOLEDB; Server=localhost; Database=数据库名称; Uid=sa; Pwd=你的数据库密码"
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open con
' 拼写SQL
strSQL = "Exec add_test '" & name & "', '" & pass & "' "

' 执行存储过程
conn.Execute(strSQL)

Set conn = Nothing
response.write "<script language=javascript> alert('温馨提示:您的资料系统已经成功保存,谢谢!');history.go(-1);</script>"
response.End
%>
ice241018 2006-06-27
  • 打赏
  • 举报
回复
数据表sql:
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[info]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[info]
GO

CREATE TABLE [dbo].[info] (
[name] [char] (10) COLLATE Chinese_PRC_CI_AS NULL ,
[pass] [char] (10) COLLATE Chinese_PRC_CI_AS NULL
) ON [PRIMARY]
GO


index.html文件
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<style type="text/css">
<!--
.STYLE2 {font-size: 12; }
-->
</style>
</head>

<body>
<form action="test_action.asp" method="post">
<table width="100%" border="0">
<tr>
<td width="44%"><div align="right" class="STYLE2">姓名:</div></td>
<td width="56%"><input name="name" type="text" id="name" size="20"></td>
</tr>
<tr>
<td><div align="right" class="STYLE2">密码:</div></td>
<td><input name="pass" type="password" id="pass" size="21"></td>
</tr>
<tr>
<td colspan="2"><div align="center" class="STYLE2">
<input type="submit" name="Submit" value="提交">
<input type="reset" name="Submit2" value="重置">
</div></td>
</tr>
</table></form>
</body>
</html>


存储过程:
CREATE PROCEDURE add_test
(
@name nvarchar(50),
@pass nvarchar(50)
)
as
insert into info (name,pass) values (@name,@pass)
GO


areslong 2006-06-27
  • 打赏
  • 举报
回复
我要的是存储过程的代码(sql) 和 调用存储过程的代码(asp)
skyhoho 2006-06-27
  • 打赏
  • 举报
回复
Dim sConString, conn, rs, sql

sConString = "Provider=SQLOLEdb;user Id=sjk;password=123456;Initial Catalog=myyp;Data Source=127.0.0.1"

sql = "SELECT id, name, zip FROM city"

Set conn = Server.CreateObject("ADODB.Conncetion")
conn.Open sConString
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sql, conn, 0, 1
...

rs.Close
Set rs = Nothing
conn.Close
Set conn = Nothing


LZ 要的??还是想要建存储过程PROCEDURE??
areslong 2006-06-27
  • 打赏
  • 举报
回复
只需要显示好了
asp007 2006-06-27
  • 打赏
  • 举报
回复
存储?是插入数据库吗?
postcode 2006-06-27
  • 打赏
  • 举报
回复
路过,帮顶一下

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧