asp 想在删除文章的同时删除图片,如何编程
Subdele()Dimrs,ThisTable,Sql,Sqlt,SqluDimTypeid,StrLevelDimWriterIDSetrs=conn.execute...
Sub dele()
Dim rs,ThisTable,Sql,Sqlt,Sqlu
Dim Typeid,StrLevel
Dim WriterID
Set rs=conn.execute("Select id,typeid,Strlevel,UseTable,UserID from [mtitle] where id="&id)
ThisTable=rs(3)
Typeid=Rs(1)
StrLevel=Rs(2)
WriterID=rs(4)
Rs.close
Set rs=nothing
If StrLevel>0 Then
Sql="Update [config] set PassArticleNum=PassArticleNum-1,AllarticleNum=AllarticleNum-1 "
Sqlt="Update [type] set AllNum=AllNum-1,PassedNum=PassedNum-1 where typeid="&typeid
Sqlu="Update [User] set ArticleNum=ArticleNum-1 where UserID="&WriterID
Conn.execute(Sqlu)
Else
Sql="Update [config] set PassarticleNum=PassarticleNum-1"
Sqlt="Update [type] set AllNum=AllNum-1 where typeid="&typeid
End if
Conn.execute(Sql)
Conn.execute(Sqlt)
Sql="delete from [mtitle] where id="&id
Conn.execute(sql)
Sql="delete from ["&ThisTable&"] where articleid="&id
Conn.execute(sql)
if request("gpage")="adr" then
response.write "<meta http-equiv=""Refresh"" content=""1; URL=MyArticle.asp?typeid="&Request("typeid")&"&curpage="&curpage&""">文章删除成功,正在返回!"
else
response.write "<meta http-equiv=""Refresh"" content=""1; URL=MyArticle.asp?typeid="&Request("typeid")&"&curpage="&curpage&""">文章删除成功,正在返回!"
end if
End sub 展开
Dim rs,ThisTable,Sql,Sqlt,Sqlu
Dim Typeid,StrLevel
Dim WriterID
Set rs=conn.execute("Select id,typeid,Strlevel,UseTable,UserID from [mtitle] where id="&id)
ThisTable=rs(3)
Typeid=Rs(1)
StrLevel=Rs(2)
WriterID=rs(4)
Rs.close
Set rs=nothing
If StrLevel>0 Then
Sql="Update [config] set PassArticleNum=PassArticleNum-1,AllarticleNum=AllarticleNum-1 "
Sqlt="Update [type] set AllNum=AllNum-1,PassedNum=PassedNum-1 where typeid="&typeid
Sqlu="Update [User] set ArticleNum=ArticleNum-1 where UserID="&WriterID
Conn.execute(Sqlu)
Else
Sql="Update [config] set PassarticleNum=PassarticleNum-1"
Sqlt="Update [type] set AllNum=AllNum-1 where typeid="&typeid
End if
Conn.execute(Sql)
Conn.execute(Sqlt)
Sql="delete from [mtitle] where id="&id
Conn.execute(sql)
Sql="delete from ["&ThisTable&"] where articleid="&id
Conn.execute(sql)
if request("gpage")="adr" then
response.write "<meta http-equiv=""Refresh"" content=""1; URL=MyArticle.asp?typeid="&Request("typeid")&"&curpage="&curpage&""">文章删除成功,正在返回!"
else
response.write "<meta http-equiv=""Refresh"" content=""1; URL=MyArticle.asp?typeid="&Request("typeid")&"&curpage="&curpage&""">文章删除成功,正在返回!"
end if
End sub 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询