我曾经在数据库中搜索SQL。
HTML:
<form name="frmReport" method="get" action="">
<input id="txtKeyword" class="textbox" type="text" size="1" name="Keyword" value="<%=Keyword%>">
<input type="text" name="SDate" style="width:100; height:19" size="20" id="datepicker" class="textbox">
<input type="text" name="EDate" style="width:100; height:19" size="20" id="datepickerExp" class="textbox">
<input type="submit" value="viewReport" name="btnSearch" style="font-family: Arial, Tahoma; font-size: 9pt; border-style: outset; border-width: 2px;height:20;width:90">
</form>
ASP:
Dim Keyword, StartDate, EndDate
keyword = request.Querystring("keyword")
StartDate = request.Querystring(StartDate")
EndDate = request.Querystring("EndDate")
strSQL = "SELECT * FROM Report WHERE UserID LIKE '%" & Keyword & _
"' and DatePO BETWEEN #" & startDate & "# AND #" & endDate & "#"
RS.Open strSQL, Conn, 3, 1
Conn.Execute(strSQL)
我遇到错误(第40行是SQL语句)。
Microsoft JET数据库引擎错误&#39; 80040e07&#39;
查询表达式中的日期语法错误&#39; UserID LIKE&#39;%&#39;和DatePO BETWEEN ##&gt; = ## AND ##&lt; = ##&#39;。 /ViewReport.asp,第40行