这个数据库插入该怎么写?

pretty_yang pretty_yang 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
为啥每次都是文章插入不了数据库,也不能重定向回原来页面?
<% Response.Buffer=True %>
<!--#Include file="conn.asp"-->
<html>
<head>
<title>回复文章</title>
</head>
<body>
<%
Dim art_id,title
art_id=Request("art_id") '返回欲回复文章编号
title=Request("title") '返回欲回复文章标题
%>
<h2 align="center">回复文章</h2>
<center>
<table border="0" width=90%>
<form method="post" action="" name="form1" >
<tr><td>主题:</td><td><input type="text" name="title" size="60"
value="re:<%=title%>"></td>
</tr>
<tr><td>内容:</td><td><textarea name="body" rows="4" cols="60" wrap="soft">
</textarea></td></tr>
<tr><td></td><td><input type="submit" value=" 提交 " size="20"></td></tr>
</form>
</table>
</center>
<p align=center><a href="particular.asp?art_id=<%=art_id%>">返回首页</a>
<%
If Request("title")<>"" And session("user_name")<>"" Then
Dim body,layer,parent_id,child,hits,user_name
title=Request.Form("title")
body=Request.Form("body")
user_name=session("user_name")
layer=2
parent_id=art_id
child=0
hits=0


Dim sql,svalues
sql="Insert Into art(title,layer,parent_id,child,hits,user_name,submit_date"
svalues = "Values('" & title & "'," & layer & "," & parent_id & "," &child & "," & hits & ",'" & user_name & "','" & now() & "'"

If body<>"" Then '如果有内容,则添加body字段
sql = sql & ",body"
svalues = svalues & "," & "'" & body & "'"

End If
sql = sql & ") " & svalues & ")"
db.Execute(sql)
db.Close
'重定向回原来页面
Response.Redirect "particular.asp?art_id=" & art_id
End If
%>
</body>
</html>
...全文

相关推荐

评论 7
收藏 已收藏
分享
返回顶部
pretty_yang
ASP 28,400 成员 356,938 内容