出来るのだASP Q&A掲示板(過去LOG)
訪問数 52046
昨日 889
今日 776 【PR】 パソコン入門からIT専門書まで幅広く取り揃えています。セブン-イレブン受取り手数料無料のセブンアンドワイ。 |
![]() ![]() ![]() ![]() ![]() |
[4481] 同一ページに初期全部表示と検索表示 |
投稿者:ビバジャイアンツ!さん 2004/07/03 21:31:26 |
下記のような、競馬のデータを扱うデータベースを自作しています。今の状態ですと、全部のデータは表示されますが、検索によるデータの表示が出来ません。具体的な目的は、このページが@初期起動時は全て表示A検索ボタンによる抽出表示 の2点が出来るページにすることです。自分で試みたのですが、どうしても、@かA のどちらかのみしか出来ません。VBAですと、最初からデータが全て表示されている中で、 フォーム名.filter=抽出条件 フォーム名.filteron=True で行うことが出来ます。ですが、まだ初心者であるせいか、ASPで行うことが出来ません。どうか、ASPのベテランの方、よきアドバイスをお願いします。 ●記述 <%@ LANGUAGE="VBScript" %> <% Set cnc =Server.CreateObject("ADODB.Connection")'初期競馬日程全部表示 cnc.open"UMA" set rstTK =Server.createObject("ADODB.Recordset") '月基本週日付 rstTK.Open "月基本週日付データ", cnc, adOpenKeyset, adLockOptimistic set rstKH =Server.createObject("ADODB.Recordset") '基本日付 rstKH.Open "基本日付データ", cnc, adOpenKeyset, adLockOptimistic set rstRM =server.createObject("ADODB.Recordset") 'レース名 rstRM.Open "レース名データ", cnc, adOpenKeyset, adLockOptimistic set rstRJ =Server.CreateObject("ADODB.Recordset") 'レース順 rstRJ.Open "レース順データ", cnc, adOpenKeyset, adLockOptimistic set rstSB =Server.createObject("ADODB.Recordset") '総合馬場 rstSB.Open "総合馬場データ", cnc, adOpenKeyset, adLockOptimistic set rstBJ =Server.createObject("ADODB.Recordset") '馬場状態 rstBJ.Open "馬場状態データ", cnc, adOpenKeyset, adLockOptimistic set rstGD =server.createObject("ADODB.Recordset") 'グレードデータ rstGD.Open "グレードデータ", cnc, adOpenKeyset, adLockOptimistic Set rst =Server.CreateObject("ADODB.Recordset") '競馬日程全部表示 strSQL="Select * from 競馬日程 where レース年代日付 is not null order by レース年代日付 " rst.Open strSQL, cnc, adOpenstatic ,adLockOptimistic %> <html> <head> <title>競馬成績検索</title> <body> <Marquee BGCOLOR="RED"><b><I>競馬日程/</I></b><%= rst.recordcount %>件</Marquee><br> <form action="検索競馬日程.asp" method="POST" > <table> <tbody><tr> <td>日付:</td><td><input type="text" name="年代日付" value=""size=15 >曜日:<input type="text" name="曜日" value=""size=2></td><tr> <td>R順:</td><td><select name="R順" > <option><%="" %> <% lnr=0 do until lnr=rstRJ.recordcount lnr=lnr+1 %> <option><%= rstRJ("レース順") %> <% rstRJ.Movenext Loop %></select></td><tr> <td>レース名:</td><td><select name="レース名" > <option><%="" %> <% lng=0 do until lng=rstRM.recordcount lng=lng+1 %> <option><%= rstRM("レース名") %> <% rstRM.Movenext Loop %></select></td><tr> <td>総合馬場:</td><td><select name="総合馬場" size=1> <option><%="" %> <% lnj=0 do until lnj=rstSB.recordcount lnj=lnj+1 %> <option><%= rstSB("総合馬場") %> <% rstSB.Movenext Loop %></select> 状態:<select name="状態" > <option><%="" %> <% lnr=0 do until lnr=rstBJ.recordcount lnr=lnr+1 %> <option><%= rstBJ("馬場状態") %> <% rstBJ.Movenext Loop %></select></td> </tr> </tbody><br></table> <input type="submit" value="↓検索" ><input type="reset" value="↑クリア"><br> </form> <% Response.write"<TABLE BORDER=1 BGCOLOR=#ffffff CELLSPACING=0>" Response.write"<thead><tr>" Response.write"<TH BGCOLOR=#c0c0c0 BORDERCOLOR=#000000 >競馬成績</th>" Response.Write "<TH BGCOLOR=#c0c0c0 BORDERCOLOR=#000000 >年代日付</TH>" Response.Write "<TH BGCOLOR=#c0c0c0 BORDERCOLOR=#000000 >年代</TH>" Response.write"<TH BGCOLOR=#c0c0c0 BORDERCOLOR=#000000 >曜日</th>" Response.Write "<TH BGCOLOR=#c0c0c0 BORDERCOLOR=#000000 >月基本週日付</TH>" Response.Write "<TH BGCOLOR=#c0c0c0 BORDERCOLOR=#000000 >基本日付</TH>" Response.Write "<TH BGCOLOR=#c0c0c0 BORDERCOLOR=#000000 >R順</TH>" Response.Write "<TH BGCOLOR=#c0c0c0 BORDERCOLOR=#000000 >レース名</TH>" Response.Write "<TH BGCOLOR=#c0c0c0 BORDERCOLOR=#000000 >総合馬場</TH>" Response.Write "<TH BGCOLOR=#c0c0c0 BORDERCOLOR=#000000 >状態</TH>" Response.Write "</tr></thead>" Do Until rst.EOF or line >20 %> <% rstTK.filter="[月基本週日付ID]=" & rst("月基本週日付ID") %> <% rstKH.filter="[基本日付ID]=" & rst("基本日付ID") %> <% rstRJ.filter="[レース順ID]=" & rst("レース順ID") %> <% rstRM.filter="[レース名ID]=" & rst("レース名ID") %> <% rstSB.filter="[総合馬場ID]=" & rst("総合馬場ID") %> <% rstBJ.filter="[馬場状態ID]=" & rst("馬場状態ID") %> <tbody><form action="競馬成績.asp" method="POST"> <td><input type="submit" value="競馬成績" size=5></td> <td><font color="Red"><%= rst("レース年代日付") %></font></td> <td><%= rst("年代") %></td> <td><%= rst("曜日") %></td> <td><%= rstTK("月基本週日付") %></td> <td><%= rstKH("基本日付") %></td> <td><%= rstRJ("レース順") %></td> <td><b><%= rstRM("レース名") %></b></td> <td><H6><%= rstSB("総合馬場") %></H></td> <td align=center><%= rstBJ("馬場状態") %></td> <input type=hidden name="data1" value=<%= rst("競馬日程ID") %> size=5> </form> <% rst.MoveNext line=line+1 Loop %> </tbody></table> <% rstSB.close rstBJ.close rstRM.close rstRJ.close rstKH.close rstTK.close set rstRM=nothing set rstSB=nothing set rstBJ=nothing set rstRJ=nothing set rstTK=nothing set rstKH=nothing %> <%= rst.absoluteposition %>件目/<%= rst.recordcount %>件<br> <%= Session("page") %>ページ目/ <%= rst.pagecount %>ページ <% rst.close set rst=nothing cnc.close set cnc=nothing %> </body> </html> |
![]() ![]() ![]() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
TreeBBS For ASP V.0.1.3 |