一个产品发布的保存实现页面,总是提示已经发布(事实不是如此),数据库(SQL)连接没有问题,请问怎么解决?

Lengjian 2004-04-13 11:52:07
一个产品发布的保存实现页面,总是提示已经发布(事实不是如此),数据库(SQL)连接没有问题,请问怎么解决?(原来是ACCESS,没有问题;转换到SQL时才发生这样的问题)
页面代码:
<%@ codepage ="936" %>
<%OPTION EXPLICIT%>
<!--#include FILE="upload_5xsoft.inc"-->
<!--#include file="../../conn/dbconn2.asp"-->
<!--#include file="../../inc/config.asp"-->
<html>
<body>
<%
dim upload,file,formName,formPath,iCount,gsid,filename,rs,sql,picture
dim cpbh,cpmc,cpsb,cpjg,cpgg,bighy,lithy,jysm,xxsm,sf,city,sccj,lxr,address,postcode,phone,fax,email,web
set upload=new upload_5xSoft
function MakedownName()
dim fname
fname = now()
fname = replace(fname,"-","")
fname = replace(fname," ","")
fname = replace(fname,":","")
fname = replace(fname,"PM","")
fname = replace(fname,"AM","")
fname = replace(fname,"上午","")
fname = replace(fname,"下午","")
fname = int(fname) + int((10-1+1)*Rnd + 1)
MakedownName=fname
end function
formPath=upload.form("filepath")
if right(formPath,1)<>"/" then formPath=formPath&"/"
cpbh=upload.form("cpbh")
cpmc=upload.form("cpmc")
cpsb=upload.form("cpsb")

cpjg=upload.form("cpjg")
cpgg=upload.form("cpgg")
bighy=upload.form("bighy")
lithy=upload.form("lithy")
jysm=upload.form("jysm")
xxsm=upload.form("xxsm")
sccj=upload.form("sccj")
lxr=upload.form("lxr")
address=upload.form("address")
postcode=upload.form("postcode")
sf=upload.form("sf")
city=upload.form("city")
phone=upload.form("phone")
fax=upload.form("fax")
email=upload.form("email")
web=upload.form("web")
gsid=session("id")
iCount=0
for each formName in upload.file
set file=upload.file(formName)
if file.FileSize>0 then
if file.filesize>200000 then
HtmEnd "您上传的文件大于规定大小(200K),请改变文件大小后再进行上传。"
else
if trim(right(file.FileName,3))<>"jpg" and trim(right(file.FileName,3))<>"gif" then
HtmEnd "您上传的文件GIF或JPG图象文件,请将你上传的文件转换此格式后再进行上传。"
else
FileName=gsid&MakedownName()&"."&mid(file.FileName,InStrRev(file.FileName, ".")+1)
file.SaveAs Server.mappath(formPath&FileName)
picture=FileName
iCount=iCount+1
set rs=server.createobject("adodb.recordset")
sql="select * from spzs where cpmc='"&upload.form("cpmc")&"'and sccj='"&upload.form("sccj")&"'"
rs.open sql,conn,1,3
if not rs.eof then
response.write"<SCRIPT language=JavaScript>alert('对不起,您已经提交过此类产品!');"
response.write"javascript:history.go(-1)</SCRIPT>"
response.end
else
rs.addnew
rs("cpbh")=cpbh &"-" & gsid
rs("cpmc")=cpmc
rs("cpsb")=cpsb

rs("cpjg")=cpjg
rs("cpgg")=cpgg
rs("picture")=picture
rs("sortid")=bighy
rs("typeid")=lithy
rs("jysm")=jysm
rs("xxsm")=xxsm
rs("sccj")=sccj
rs("lxr")=lxr
rs("address")=address
rs("postcode")=postcode
rs("sf")=sf
rs("city")=city
rs("phone")=phone
rs("fax")=fax
rs("email")=email
rs("web")=web
rs("gsid")=gsid
rs("idate")=dateadd()
rs.update
rs.close
set rs=noting
conn.close
set conn=nothing
set upload=nothing
response.redirect ("showing.asp#a")
end if
end if
end if
set file=nothing
end if
next
%>
<%
response.write"<SCRIPT language=JavaScript>alert('对不起,您上传的图片有错误,请检查!!');"
response.write"javascript:history.go(-1)</SCRIPT>"
response.end
%>
...全文
10 点赞 收藏 14
写回复
14 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
Lengjian 2004-05-02
怎么一直没有高手回答?
回复
qxg1123 2004-04-14
你连的是不是导过后的sql不会还连在access上吧
回复
Lengjian 2004-04-14
我把判断是否已发布(重复)的代码去掉了,发现根本没有写入数据!怎么回事?
这样写不对吗?
set rs=server.createobject("adodb.recordset")
sql="select * from spzs where cpmc='"&upload.form("cpmc")&"'and sccj='"&upload.form("sccj")&"'"
rs.open sql,conn,1,3
rs.addnew
rs("cpbh")=cpbh &"-" & gsid
rs("cpmc")=cpmc
rs("cpsb")=cpsb
rs("cpcd")=cpcd
rs("cpjg")=cpjg
rs("cpgg")=cpgg
rs("picture")=picture
rs("sortid")=bighy
rs("typeid")=lithy
rs("jysm")=jysm
rs("xxsm")=xxsm
rs("sccj")=sccj
rs("lxr")=lxr
rs("address")=address
rs("postcode")=postcode
rs("sf")=sf
rs("city")=city
rs("phone")=phone
rs("fax")=fax
rs("email")=email
rs("web")=web
rs("gsid")=gsid
rs("idate")=getdate()
rs.update
rs.close
set rs=noting
conn.close
set conn=nothing
回复
Lengjian 2004-04-14
还是不可以!!!
回复
Lengjian 2004-04-14
不会,access数据库已经删除了
回复
Lengjian 2004-04-13
各路大侠都不在?在线等,解决立即给分,不够再加分!
回复
qxg1123 2004-04-13
sql="select * from spzs where (cpmc='"&trim(upload.form("cpmc"))&"'and sccj='"&trim(upload.form("sccj"))&"'")
先试试,以前可以,现在不可以,肯定是这个sql语句有问题
回复
Lengjian 2004-04-13
继续求解,再顶!!!请高手帮忙!
回复
Lengjian 2004-04-13
id是自动编号,在SQL中设置为“标识‘是’”;还需要做其它处理吗?
回复
Newrocky 2004-04-13
用ACCESS时有自动编号的字段吗???

是否处理了?
回复
Lengjian 2004-04-13
现在报错说picture重定义
回复
pizixt 2004-04-13
sql="select * from spzs where cpmc='"&upload.form("cpmc")&"'and sccj='"&upload.form("sccj")&"'"

问题一定是出在这个SQL上的,upload.form("cpmc")和upload.form("sccj")的取值

只传一个文件看出错不
回复
Lengjian 2004-04-13
nvarchar 类型,cpmc也是
回复
pizixt 2004-04-13
sccj是什么类型字段?
回复
相关推荐
发帖
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
帖子事件
创建了帖子
2004-04-13 11:52
社区公告
暂无公告