我在桌面上刪帖子
發表于:2007-07-14來源:作者:點擊數:
標簽:
'del. vb s option explicit dim message,result dim title,text1,text2 message="請輸入要刪除帖子的ID" title="帖子刪除" text1="你取消了操作!" result =inputbox(message,title,"請輸入要刪除帖子的ID") if result ="" then Wscript.echo text1 elseif
'del.
vbs
option explicit
dim message,result
dim title,text1,text2
message="請輸入要刪除帖子的ID"
title="帖子刪除"
text1="你取消了操作!"
result =inputbox(message,title,"請輸入要刪除帖子的ID")
if result ="" then
Wscript.echo text1
elseif isnumeric(result)=false then
Wscript.echo "請輸入正確的ID!"
ElseIf trim(cint(result))<>trim(result) then
Wscript.echo "請輸入正確的ID!"
Else
dim result1
result1=msgbox("你確定要刪除帖子"&result&vbcrlf&"這一操作將刪除帖子本身及帖子的所有子貼",48+1+256,"按 確定 刪除,按 取消 放棄!")
if result1=vbok then
dim conn
Set conn = Wscript.CreateObject("ADODB.Connection")
conn.Open"driver={sql server};server=111.111.111.111;uid=11;pwd=11;"&"database=11;"
dim sql,rs,sql2,rs2,sql3
sql="select rootid,deep,ordernum from bbs where mianid ="&cint(result)
set rs=conn.execute(sql)
if not rs.eof then
if rs(0)=0 then
sql3="delete bbs where rootid="&result&" or mianid= "&result
else
sql2="select top 1 ordernum from bbs where rootid="&rs(0)&" and deep<="&rs(1)&" and ordernum >"&rs(2)&"order by ordernum "
set rs2=conn.execute(sql2)
if not rs2.eof then
sql3="delete bbs where ordernum >="&rs(2)&" and ordernum < "&rs2(0)&" and rootid="&rs(0)
else
sql3="delete bbs where ordernum >="&rs(2)&" and rootid="&rs(0)
end if
end if
dim introws
conn.execute(sql3),introws
if introws >0 then
Wscript.echo "刪除成功 !"
else
Wscript.echo "刪除失敗 !"
end if
else
Wscript.echo"你要刪除的帖子不存在!"
End if
else
Wscript.echo "你放棄了刪除!"
end if
end if
原文轉自:http://www.kjueaiud.com