asp向SQL写数据,请ASP高手帮忙修改一下代码。

来源:百度知道 编辑:UC知道 时间:2024/06/10 16:00:32
我的一个多选项页面,目的是选取要提交的数据,然后增加到SQL数据库上。请高手帮忙修改一下该页面。怎样实现,我选取后成功提交到相应帐号的表单内。CONN.asp连接正常的。就不放上来了。就是这个提交页面。<!--#include file="conn.asp"-->
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="936"%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>

<body>
<%
Sub save(username,itemid,cnt)
sql="select * from pcikuser where userid='"&username&"'"
Set rs=conn.execute(sql)
If rs.eof Then
response.write "<script>alert('对不起,没有找到帐号:['+'"&username&"'+']!\n请查证后确保您的输入信息无误!');history.back();</script>"
else
sql="insert into give_itemlist(account,item_id,cnt) values('"&username&"',"&itemid&","&cnt&")"
conn.execute(sql)
response.write "&l

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>

<body>
<%
Sub save(username,itemid,cnt)
sql="select * from pcikuser where userid='"&username&"'"
Set rs=conn.execute(sql)
If rs.eof Then
response.write "<script>alert('对不起,没有找到帐号:['+'"&username&"'+']!\n请查证后确保您的输入信息无误!');history.back();</script>"
else
sql="insert into give_itemlist(account,item_id,cnt) values('"&username&"',"&itemid&","&cnt&")"
conn.execute(sql)
response.write "<script>alert('恭喜您,成功添加物品!');location.href='index.asp';</script>"
End if
End sub

action=request.Form("action")
If action="save" Then