ClassicASP 다중 조건문 where like 활용한 검색
페이지 정보
본문
이용방법....
SQL = "SELECT * FROM colle where 졸업년월 like '%" & atype_b & "%' and 학부 like '%" & atype_c"%' and 전공 like '%" & atype_d &"%' and 종류 like '%" & atype_e &"%' ORDER BY num DESC"
<%
s_gubun = request("s_gubun")
cal = request("cal")
s_nameK = request("s_nameK")
s_company = request("s_company")
s_text = request("s_text")
Response.Write "cal=" & cal & "<br>"
if cal = "s_company" then
s_data = "company"
Response.Write "s_company=" & s_text & "<br>"
elseif cal = "s_nameK" then
s_data = "nameK"
Response.Write "s_nameK=" & s_text & "<br>"
end if
Response.Write "s_data=" & s_data & "<br>"
SQL = "SELECT * FROM partner_MateriaiseKorea where gubun like '%" & s_gubun & "%' and " & s_data & " like '%" & s_text & "%' ORDER BY uid desc"
Set rs = Server.CreateObject("ADODB.Recordset")
response.write SQL
rs.Open SQL,dbcon,1
%>
<form method="get">
<select name="cal">
<option>선택하세요</option>
<option value="s_nameK" <% If cal = "s_nameK" Then response.write "selected" %>>성명</option>
<option value="s_company" <% If cal = "s_company" Then response.write "selected" %>>회사</option>
</select>
<input type="text" name="s_text" value="<%Response.Write s_text %>">
<input type="submit" value="검색">
</form>
참고사이트 +++
http://blog.naver.com/valvestudio?Redirect=Log&logNo=20039843557
http://kin.naver.com/qna/detail.nhn?d1id=1&dirId=1040204&docId=67478551
SQL = "SELECT * FROM colle where 졸업년월 like '%" & atype_b & "%' and 학부 like '%" & atype_c"%' and 전공 like '%" & atype_d &"%' and 종류 like '%" & atype_e &"%' ORDER BY num DESC"
<%
s_gubun = request("s_gubun")
cal = request("cal")
s_nameK = request("s_nameK")
s_company = request("s_company")
s_text = request("s_text")
Response.Write "cal=" & cal & "<br>"
if cal = "s_company" then
s_data = "company"
Response.Write "s_company=" & s_text & "<br>"
elseif cal = "s_nameK" then
s_data = "nameK"
Response.Write "s_nameK=" & s_text & "<br>"
end if
Response.Write "s_data=" & s_data & "<br>"
SQL = "SELECT * FROM partner_MateriaiseKorea where gubun like '%" & s_gubun & "%' and " & s_data & " like '%" & s_text & "%' ORDER BY uid desc"
Set rs = Server.CreateObject("ADODB.Recordset")
response.write SQL
rs.Open SQL,dbcon,1
%>
<form method="get">
<select name="cal">
<option>선택하세요</option>
<option value="s_nameK" <% If cal = "s_nameK" Then response.write "selected" %>>성명</option>
<option value="s_company" <% If cal = "s_company" Then response.write "selected" %>>회사</option>
</select>
<input type="text" name="s_text" value="<%Response.Write s_text %>">
<input type="submit" value="검색">
</form>
참고사이트 +++
http://blog.naver.com/valvestudio?Redirect=Log&logNo=20039843557
http://kin.naver.com/qna/detail.nhn?d1id=1&dirId=1040204&docId=67478551
댓글목록
등록된 댓글이 없습니다.