<?xml version="1.0" encoding="UTF-8"?>
<%
'最后修改时间2006.03.23
on error resume next
dim conn,bbsurl
dim dbpath
bbsurl="http://www.chaotie.com/chaotie/"                '你的site的url，最后边需要有“/”号
    set conn=server.createobject("adodb.connection")
DBPath = Server.MapPath("dataasdfsd3fvdfsdfdsfd787fsdfsdsdgfsdg/7dataasdfsd3fvdfsdfdsfd787fsdfsdsdgfsdg.mdb")           'XXX/XXXXX.MDB代表你的论坛的数据库相对路径
conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath
SET rs = Server.CreateObject("ADODB.Recordset")
Rs.Open "Select Top 200 TopicID,BoardID,lastposttime From Dv_Topic ORDER BY TopicID desc" ,conn,1,3
%>
<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">
  <url>
    <loc>http://www.chaotie.com/chaotie/index.asp</loc>
    <lastmod><% 
ree=wf_DateToChar(now(),"s")
ewrr=replace(ree," ","T")
response.write ewrr&"+08:00"
%></lastmod>
    <changefreq>always</changefreq>
    <priority>1.0</priority>
  </url><%do while not rs.eof or rs.bof%>
  <url>
    <loc><%= bbsurl &"dispbbs.asp?BoardID="&Rs("boardid")&"&#38;ID="&Rs("topicid")%><%'数据库读取帖子id%>
</loc>
    <lastmod><%
aa=Rs("lastposttime")
cc=wf_DateToChar(aa,"s")
tme=replace(cc," ","T")
if instr(tme,":")-instr(tme,"T")=2 then tme=replace(tme,"T","T0")
response.write tme&"+08:00"

%><%'从数据库读取最后提交时间%>

</lastmod>
    <changefreq>daily</changefreq>
    <priority>1.0</priority>
  </url><%rs.movenext
loop%>
</urlset>
<%
rs.close
set rs = nothing
conn.close
set conn = nothing
''----日期转化函数-----   
function wf_DateToChar(datetime,l)
    dim ls_date,ls_getstr
    if isnull(l) or trim(l)="" then l="s"
    if isdate(datetime) then  
        ls_date=cstr(datetime)   
        ''writeln  ls_date
        ls_getstr=DatePart("yyyy",cdate(ls_date))
        ls_getstr=ls_getstr & "-" & wf_ctonstr(DatePart("m",cdate(ls_date)),2)
        ls_getstr=ls_getstr & "-" & wf_ctonstr(DatePart("d",cdate(ls_date)),2)
        if l="d" then wf_DateToChar=ls_getstr
        ls_getstr=ls_getstr & " " & wf_ctonstr(DatePart("h",cdate(ls_date)),2)
        ls_getstr=ls_getstr & ":" & wf_ctonstr(DatePart("n",cdate(ls_date)),2)
        if l="n" then wf_DateToChar=ls_getstr
        ls_getstr=ls_getstr & ":" & wf_ctonstr(DatePart("s",cdate(ls_date)),2)
        if l="s" then wf_DateToChar=ls_getstr
        if l="long" then wf_DateToChar=DatePart("yyyy",cdate(ls_date))&"年"&wf_ctonstr(DatePart("m",cdate(ls_date)),2)&"月"&wf_ctonstr(DatePart("d",cdate(ls_date)),2)&"日"
        if l="no"   then wf_DateToChar=DatePart("yyyy",cdate(ls_date))&wf_ctonstr(DatePart("m",cdate(ls_date)),2)&wf_ctonstr(DatePart("d",cdate(ls_date)),2)
        if l="short"   then wf_DateToChar=right(DatePart("yyyy",cdate(ls_date)),2)&wf_ctonstr(DatePart("m",cdate(ls_date)),2)&wf_ctonstr(DatePart("d",cdate(ls_date)),2)
        if l="t" then wf_DateToChar=wf_ctonstr(DatePart("m",cdate(ls_date)),2)&wf_ctonstr(DatePart("d",cdate(ls_date)),2)&" "& wf_ctonstr(DatePart("h",cdate(ls_date)),2)& ":" & wf_ctonstr(DatePart("n",cdate(ls_date)),2)
        
    else
        wf_DateToChar=Null
    end if
    
end function
''----把一位整数转化为两位整数----"1" to "01"
function wf_ctonstr(num,n)
if not IsNumeric(num) then
    wf_ctonstr=num
else
    if len(cstr(cint(num)))>=n then
        wf_ctonstr=cstr(cint(num))
    else
        wf_ctonstr="0"&cstr(cint(num))
        while len(wf_ctonstr)<n
            wf_ctonstr="0"&cstr(wf_ctonstr)
        wend
    end if
end if
end function
%>