%@LANGUAGE="VBSCRIPT" CODEPAGE="932"%>
<%
select_year =Request.Querystring("year")
select_month =Request.Querystring("month")
wn_month = select_year &"/"& select_month &"/"
%>
<%
If IsEmpty(Request.Querystring("year")) or IsEmpty(Request.Querystring("month")) = True Then
call Show_ErrorMsg()
Else
call Show_History(select_year,select_month)
End If
%>
<%
Function Show_ErrorMsg
Response.Write("年月が指定されていません")
End Function
Function Show_History(select_year,select_month)
'ADO DB Connection オブジェクトを作成する
Set db1=Server.CreateObject("ADODB.Connection")
'DBオープン (Provider・ID・パスはGlobal.asaに記載)
db1.open Application("DBCN")
'Where Like で、指定月の単語を含むレコードを探し出す
'ORDER BY wn_date DESC で書き込み時刻の降順にする
Set rs1 = db1.Execute("Select * From wn Where Convert(Varchar,[wn_date],111) Like '%" & wn_month &"%' ORDER BY wn_date DESC")
nCNT = 1
%>
 |
<% Do While rs1.EOF = False '.EOFがFalseの間ループ %>
><%
new_date = Year(rs1.Fields.Item("wn_date")) & "/" & _
Left("00",2-Len(Month(rs1.Fields.Item("wn_date")))) & _
Month(rs1.Fields.Item("wn_date")) & "/" & _
Left("00",2-Len(Day(rs1.Fields.Item("wn_date")))) & _
Day(rs1.Fields.Item("wn_date"))
If ck_date <> new_date Then
splkey = split(new_date,"/")
Response.Write splkey(0) &"年"& splkey(1) &"月"& splkey(2) &"日"
else
Response.Write " "
End If
%> |
><% Response.Write rs1.Fields.Item("title") %> |
<%
ck_date = new_date
rs1.MoveNext '次のレコードへ
nCNT = nCNT + 1
Loop
%>
|
<%
'開いていたレコードセットを閉じる
rs1.Close
'データベースを閉じる
db1.Close
'オブジェクト開放
Set db = Nothing
End Function
%>
<%
'ADO DB Connection オブジェクトを作成する
Set db2=Server.CreateObject("ADODB.Connection")
'DBオープン (Provider・ID・パスはGlobal.asaに記載)
db2.open Application("DBCN")
'Where Like で、指定月の単語を含むレコードを探し出す
'ORDER BY wn_date DESC で書き込み時刻の降順にする
Set rs2 = db2.Execute("Select * From wn ORDER BY wn_date DESC")
%>
<%
'開いていたレコードセットを閉じる
rs2.Close
'データベースを閉じる
db2.Close
'オブジェクト開放
Set db = Nothing
%>
