出来るのだASP Q&A掲示板(過去LOG)  訪問数 52046 昨日 889 今日 776
    【PR】 パソコン入門からIT専門書まで幅広く取り揃えています。セブン-イレブン受取り手数料無料のセブンアンドワイ。
Topに戻る 掲示板に戻る 検索 削除 管理者

[3216] 検索結果にあてはまらない時のタイトル行の非表示について
投稿者:うずまき猫さん 2003/02/24 20:02:41
はじめまして。今年からASPをはじめた超初心者です。
元のDBはアクセス2000で作っていて、Netscape上で検索画面を表示させています。プログラム言語はわからないので、ultradevelperで作成しています。
検索条件は表示できるようになったのですが、検索条件に含まれないデータを選択した際に、結果の画面に、テーブルのタイトル行を非表示にさせ、「検索結果はありませんでした」という結果を表示させたいのですが、うまくいきません。「検索結果は・・」というコメントは出るのですが、タイトル行は非表示にならず、コメントの下に出てきます。来月半ばが納期となっており、困り果てております。どなたかご教授頂きますよう御願い致します。
以下が現在の状況です・・・。
-----------------------------------------------------------
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="../Connections/contract02.asp" -->
<%
Dim result__MMColParam
result__MMColParam = "1"
if (Request.Form("select1") <> "") then result__MMColParam = Request.Form("select1")
%>
<%
set result = Server.CreateObject("ADODB.Recordset")
result.ActiveConnection = MM_contract02_STRING
result.Source = "SELECT * FROM Q_締結状況 WHERE 職制CD = " + Replace(result__MMColParam, "'", "''") + ""
result.CursorType = 0
result.CursorLocation = 2
result.LockType = 3
result.Open()
result_numRows = 0
%>
<%
Dim Repeat1__numRows
Repeat1__numRows = -1
Dim Repeat1__index
Repeat1__index = 0
result_numRows = result_numRows + Repeat1__numRows
%>
<%
' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters

' create the list of parameters which should not be maintained
MM_removeList = "&index="
If (MM_paramName <> "") Then MM_removeList = MM_removeList & "&" & MM_paramName & "="
MM_keepURL="":MM_keepForm="":MM_keepBoth="":MM_keepNone=""

' add the URL parameters to the MM_keepURL string
For Each Item In Request.QueryString
NextItem = "&" & Item & "="
If (InStr(1,MM_removeList,NextItem,1) = 0) Then
MM_keepURL = MM_keepURL & NextItem & Server.URLencode(Request.QueryString(Item))
End If
Next

' add the Form variables to the MM_keepForm string
For Each Item In Request.Form
NextItem = "&" & Item & "="
If (InStr(1,MM_removeList,NextItem,1) = 0) Then
MM_keepForm = MM_keepForm & NextItem & Server.URLencode(Request.Form(Item))
End If
Next

' create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth = MM_keepURL & MM_keepForm
if (MM_keepBoth <> "") Then MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
if (MM_keepURL <> "") Then MM_keepURL = Right(MM_keepURL, Len(MM_keepURL) - 1)
if (MM_keepForm <> "") Then MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)

' a utility function used for adding additional parameters to these strings
Function MM_joinChar(firstItem)
If (firstItem <> "") Then
MM_joinChar = "&"
Else
MM_joinChar = ""
End If
End Function
%>

<html>
<head>
<title>締結状況結果</title>
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
</head>
<body bgcolor="#FFFFFF" text="#000000">

<%if CurrentRecord = 0 Then %>
<%Response.Write("検索結果はありませんでした")%>
<%
While ((Repeat1__numRows <> 0) AND (NOT result.EOF))
%>
<table width="70%" border="1">
<tr>
<td width="20%" bgcolor="#FFCC99" height="24" nowrap>
<div align="center">部署名</div>
</td>
<td width="15%" bgcolor="#FFCC99" height="24" nowrap>
<div align="center">担当名</div>
</td>
<td width="10%" bgcolor="#FFCC99" height="24" nowrap>
<div align="center">地域</div>
</td>
<td width="20%" bgcolor="#FFCC99" height="24" nowrap>
<div align="center">顧客名</div>
</td>
<td width="20%" bgcolor="#FFCC99" height="24" nowrap>
<div align="center">対象商品等</div>
</td>
<td width="15%" bgcolor="#FFCC99" height="24" nowrap>
<div align="center">締結状況</div>
</td>
</tr>
<% End If %>

<%
While ((Repeat1__numRows <> 0) AND (NOT result.EOF))
%>
<tr>
<td height="33" width="20%" nowrap><%=(result.Fields.Item("部課名").Value)%></td>
<td height="33" width="15%" nowrap><%=(result.Fields.Item("営業担当者").Value)%></td>
<td height="33" width="10%" nowrap><%=(result.Fields.Item("地域").Value)%></td>
<td height="33" width="20%" nowrap><%=(result.Fields.Item("顧客名").Value)%></td>
<td height="33" width="20%" nowrap><%=(result.Fields.Item("対象商品").Value)%></td>
<td height="33" width="15%" nowrap>
<div align="center"><A HREF="result2.asp?<%= MM_keepURL & MM_joinChar(MM_keepURL) & "=" & result.Fields.Item("").Value %>">詳細</A>
</div>
</td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
result.MoveNext()
Wend
%>


</table>
</body>
</html>
<%
result.Close()
%>

検索結果にあてはまらない時のタイトル行の非表示について   うずまき猫さん [2003/02/24 20:02:41] [3216]
  Re:検索結果にあてはまらない時のタイトル行の非表示について   nowheremanさん [2003/02/25 15:45:20] [3217]
    Re:検索結果にあてはまらない時のタイトル行の非表示について   nowheremanさん [2003/02/25 15:48:06] [3218]


TreeBBS For ASP V.0.1.3
Program By YasNet