<%
set fs=server.createobject("scripting.filesystemobject")
filepath=server.mappath("../txt/"& keyfile)
set mytextfile=fs.opentextfile(filepath,1,true)
if not mytextfile.atendofstream then
response.write mytextfile.readall
end if
mytextfile.close
set mytextfile=nothing
%>
<%call searchresult()%>
<%
function readPositionCode(cPositionCode)
dim funstr
if cPositionCode <> "" then
set fs=server.createobject("scripting.filesystemobject")
filepath="d:\udcweb_2003\2005software\txt\2005doc_"&cPositioncode&".txt"
'response.write cPositionCode
set mytextfile=fs.opentextfile(filepath)
funstr = mytextfile.ReadAll
mytextfile.close
set mytextfile=nothing
set fs=nothing
readPositionCode = funstr
else
readPositionCode = "loading......"
end if
end function
sub searchresult()
csql = "select a.cdoc_id,a.ctitle,a.cPush_Date"
csql = csql & " FROM tbl_article a left outer join tbl_article_pic c on a.cdoc_id = c.cDoc_id "
csql = csql & "WHERE a.c2 <> '1' and a.c2 <> '3' and a.cdoc_type = '"&cdoctype&"' "
csql = csql & "and a.cChanNelCode = '22' and right(a.cdoc_id,2) = '01' "
csql = csql & "and a.cPush_Date <= CONVERT(char(10), GETDATE(), 20) "
' if ctype_code <> "" then
' csql = csql & "and a.ctype_code = '"&ctype_code&"' "
' end if
if startdate <> "" then
csql = csql & "and CAST(cPush_Date AS datetime) >= '"&startdate&"' "
end if
if enddate <> "" then
csql = csql & "and CAST(cPush_Date AS datetime) <= '"&enddate&"' "
end if
if keyword <> "" then
csql = csql & "and (c.ckey like '%"&keyword&"%' or a.ctitle like '%"&keyword&"%') "
end if
csql = csql & " order by a.cDoc_id Desc"
'response.write csql
'Response.end
set udc_conn=server.createobject("adodb.connection")
set udc_rs=server.createobject("adodb.recordset")
'udc_conn.open "provider=sqloledb;server=202.106.124.16;datebase=new_udc18;uid=input_wenzhang;pwd=da4w%4gr9u_@$#;network=dbmssocn"
udc_conn.open "provider=sqloledb;server=202.106.124.45;database=udc_new18;uid=user_wenzhang;pwd=da4w%4gr9u_@$##;network=dbmssocn"
udc_rs.open csql,udc_conn,3
if not udc_rs.eof then
page = request("page")
if isnull(page) or page="" then page=1
udc_rs.pagesize=24
iCount=udc_rs.recordcount
pages=(icount+udc_rs.pagesize-1)\udc_rs.pagesize
if int(page) > int(pages) then page = 1
udc_rs.absolutepage=page
i = 0
str = str & "
"&vbcrlf
while not udc_rs.eof and i < udc_rs.pagesize
if i mod 6 = 0 and i > 0 then
str = str & "
"&vbcrlf
udc_rs.movenext
i = i + 1
wend
str = str & "
"&vbcrlf
response.write str
' 调用翻页子程序
parastr = "cdoctype="&cdoctype
if ctype_code <> "" then parastr = parastr & "&ctype_code="&ctype_code
if keyword <> "" then parastr = parastr & "&keyword="&keyword
if startdate <> "" then parastr = parastr & "&startdate="&startdate
if enddate <> "" then parastr = parastr & "&enddate="&enddate
call changepage(pages,page,parastr)
end if
end sub
sub changepage(pages,page,parastr)
str = ""
str = str & "
"&vbcrlf
str = str & "
"&vbcrlf
str = str & "
"&vbcrlf
if page > 1 then
str = str & "上一页"&vbcrlf
else
str = str & "上一页"&vbcrlf
end if
if int(page) < int(pages) then
str = str & "下一页"&vbcrlf
else
str = str & "下一页"&vbcrlf
end if
str = str & "选择页码:"&vbcrlf
if int(page)>((page-1)\10)*10 and page>10 then
str = str & "上十页"&vbcrlf
end if
'response.write pages
if ((int(page)-1)\10)*10 + 10 >= pages then
endpage = pages
else
endpage = ((int(page)-1)\10)*10 + 10
end if
for i = ((int(page)-1)\10)*10+1 to endpage
if i = int(page) then
str = str & ""&i&" "&vbcrlf
else
str = str & ""&i&" "&vbcrlf
end if
next
if endpage <> pages then
str = str & "下十页"&vbcrlf
end if
str = str & "