现在有个问题,网络一般性错误,有时出,有时又没有,头疼死了Set RsGuiGe=conn.execute("select top 3 id from guige where kind=1 order by dateandtime")if request("addcart")<>"" then
photoid=request("photoid")
if photoid="" then response.write "<script language='javascript'>alert('请选择需要重印的相片!!!');history.go(-1)</script>"
a=split(photoid,",")
for i=0 to ubound(a) step 1
do while not RsGuiGe.eof
conn.execute("exec Add_cart '"&a(i)&"','"&userid&"','"&RsGuiGe(0)&"'" )
RsGuiGe.movenext
loop
RsGuiGe.movefirst
next
end if
add_cart代码如下:CREATE proc Add_Cart@photoid nchar (20),
@userid nchar(20),
@guigeid nchar(10)
asdeclare @ErrMsg int /*返回错误信息*/
declare @cartid nchar(10)
declare @pid nchar(20) /*ID变量*/
declare @title nchar (30) /*相片标题*/
declare @filename nchar (100) /*相片文件名*/
declare @price int /*价格*/
declare @quantity int /*数量*/
declare @guigeName nchar (20) /*规格名称*/declare @status int /*用户状态,值为1 ,@PRICE打九折*/Set @ErrMsg='0'
Set @quantity='1'
/*
ErrMsg=0时为正确
ErrMsg=3 cart表中PID,userid 重ErrMsg=1为pid不存在
ErrMSg=2规格id未找到
*/select @cartid=id from cart where pid=@photoid and userid=@userid and guigeid=@guigeid
if @cartid is not null
set @ErrMsg='3'
Else
begin
Select @pid=pid,@filename=filename,@title=title from photos where pid=@photoid
if @pid is null
Set @Errmsg='1'
Else Begin select @guigeName=guigename,@price=price From Guige where kind='1' and id=@guigeid order by dateandtime asc
if @guigeName is not null
begin
select @status=status from usersystem where username=@userid if @status='1' set @price=@price * 0.9 if @guigeid is not null
begin
insert into cart(pid,guigeid,userid,title,filename,price,quantity,guigeName )values(@photoid,@guigeid,@userid,@title,@filename,@price,@quantity,@guigename)
end
ELSE
SET @ErrMsg='2'
End
end
end Return @ErrMsg
GO
photoid=request("photoid")
if photoid="" then response.write "<script language='javascript'>alert('请选择需要重印的相片!!!');history.go(-1)</script>"
a=split(photoid,",")
for i=0 to ubound(a) step 1
do while not RsGuiGe.eof
conn.execute("exec Add_cart '"&a(i)&"','"&userid&"','"&RsGuiGe(0)&"'" )
RsGuiGe.movenext
loop
RsGuiGe.movefirst
next
end if
add_cart代码如下:CREATE proc Add_Cart@photoid nchar (20),
@userid nchar(20),
@guigeid nchar(10)
asdeclare @ErrMsg int /*返回错误信息*/
declare @cartid nchar(10)
declare @pid nchar(20) /*ID变量*/
declare @title nchar (30) /*相片标题*/
declare @filename nchar (100) /*相片文件名*/
declare @price int /*价格*/
declare @quantity int /*数量*/
declare @guigeName nchar (20) /*规格名称*/declare @status int /*用户状态,值为1 ,@PRICE打九折*/Set @ErrMsg='0'
Set @quantity='1'
/*
ErrMsg=0时为正确
ErrMsg=3 cart表中PID,userid 重ErrMsg=1为pid不存在
ErrMSg=2规格id未找到
*/select @cartid=id from cart where pid=@photoid and userid=@userid and guigeid=@guigeid
if @cartid is not null
set @ErrMsg='3'
Else
begin
Select @pid=pid,@filename=filename,@title=title from photos where pid=@photoid
if @pid is null
Set @Errmsg='1'
Else Begin select @guigeName=guigename,@price=price From Guige where kind='1' and id=@guigeid order by dateandtime asc
if @guigeName is not null
begin
select @status=status from usersystem where username=@userid if @status='1' set @price=@price * 0.9 if @guigeid is not null
begin
insert into cart(pid,guigeid,userid,title,filename,price,quantity,guigeName )values(@photoid,@guigeid,@userid,@title,@filename,@price,@quantity,@guigename)
end
ELSE
SET @ErrMsg='2'
End
end
end Return @ErrMsg
GO
1,请确认sql数据库的配置是否正确,如 tcp和管道命名的设置
2,请检查你的网络连接是否正常及连接速度,如果连接不好或很慢会冒出这个来吓你一下的
3,就像楼说的,是否有病毒!