看看ASP哪里出错?

来源:百度知道 编辑:UC知道 时间:2024/05/02 19:56:28
<!--#include file="conn.asp"-->
<%
conn.open connstring
txt_name=request.form("txt_name")
s=request.form("s")
ly=request.form("ly")
cz=request.form("cz")
post=request.form("post")
http=request.form("http")
mail=request.form("mail")
add=request.form("add")
qy=request.form("qy")
content=request.Form("body")
txt_mu=request.form("txt_mu")
if txt_name = "" then
response.write "<script language=javascript>alert('主题不能为空!');history.go(-1);</script>"
response.End
end if
if len(txt_name)>23 then
response.write "<script language=javascript>alert('主题不能大于23个字符!');history.go(-1);</script>"
response.End
end if
if content = "" then
response.write "<script langua

sqlstring = "insert into admin_txt (txt_id,txt_name,s,ly,cz,post,http,mail,add,qy,txt_body) values ('"&txt_mu&"','"&txt_name&"','"&s&"','"&ly&"','"&cz&"','"&post&"','"&http&"','"&mail&"','"&add&"','"&qy&"','"&content&"')"

这句话有问题,写插入语句的时候最好不要用insert,写法不容易理解,要用addnew,你用这句话替换掉上面那句看看:
cs.addnew
cs("txt_id")=request.form("txt_mu")
cs("txt_name")=以此类推....
cs("s")=
cs("ly")=
cs("cz")=
cs("post")=
cs("mail")=
cs("add")=
cs("qy")=
cs("txt_body")=
cs.update
cs.close

1,是否数据类型错误
2,不需要创建记录集
sqlstring="......"
conn.execute (sqlstring)

conn.asp 中 是否已经有了conn.open connstring