トップページ統計たまごの知識協会概要リンク

<% 'ADO DB Connection オブジェクトを作成する Set db1=Server.CreateObject("ADODB.Connection") 'DBオープン (Provider・ID・パスはGlobal.asaに記載) db1.open Application("DBCN") 'ORDER BY wn_date DESC で書き込み時刻の降順にする 'Select 10 と 件数を指定しました Set rs1 = db1.Execute("Select TOP 10 * From wn ORDER BY wn_date DESC") nCNT = 1 %> <% Do While rs1.EOF = False '.EOFがFalseの間ループ %> <% ck_date = new_date rs1.MoveNext '次のレコードへ nCNT = nCNT + 1 Loop %>
><% 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") %>
<% '開いていたレコードセットを閉じる rs1.Close 'データベースも閉じようよ db1.Close 'お行儀よくオブジェクトも開放しましょう(通常は自動的に解放されるけど) Set db = Nothing %>


<% '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 %>