關于sql語句改寫?
html頁面
<form action="search.asp" method="post">
<tr >
<td colspan="2" align="center"> <input type=text size=12 name="keyword">
<br>
<select name="AreaSearch">
<option value=1>標題</option>
<option value=2>內容</option>
</select>
<br>
<select name="DateSearch">
<option value=all>所有時間</option>
<option value=1>昨天以來</option>
<option value=3>3 天以來</option>
<option value=7>7 天以來</option>
<option value=15>15天以來</option>
<option value=30>30天以來</option>
<option value=60>60天以來</option>
<option value=90>90天以來</option>
</select><br>
<input type=submit value="搜索" name="submit">
</td>
</tr>
</form>
select.asp頁面
<%
keyword=trim(request("keyword"))
dim searchday
if request("DateSearch")="all" then
searchDay=""
else
searchDay=" DATEDIFF('d',addtime,Now()) < "&request("DateSearch")&" and "
end if
dim pagecount,page,Spage,Epage,recordcount,i
page = request.querystring("page")
if page = "" or IsNull(page) then page = 1
if not IsNumeric(page) then page = 1
page = Cint(page)
set rs = server.CreateObject ("Adodb.recordset")
if request("AreaSearch")=1 then
'''''改寫下面這一句'''''
sql="select * from article where "& searchday &" (" & translate(keyword,"title") & ") order by id desc"
elseif request("AreaSearch")=2 then
sql="select * from article where "& searchday &" (" & translate(keyword,"content") & ") order by id desc"
''''''''''''
end if %>
改為''''''''
sql="select* from aticle where searchday=""and title="keyword" order by id desc"
elseif request("Areaserch")=2 then
sql="select* from article where searchday=""and content="keyword" order by
id desc"
對嗎