|
rrnml -> Type mismatch error (5/16/2005 15:52:37)
|
Not sure what a type mismatch error is. And I'm not sure I've gone about this query the right way. I have a query where you can search by either a keyword or by a user. I'm not sure I have it right. Well obviously it's not right if I'm getting an error! Anyway if anyone can see what I've done wrong please let me know. Here's the code...... Thanks.
' Create the SQL Query String
strParm1 = Request.Form("fdate")
strParm2 = Request.Form("tdate")
strSearchterm = Request.Form("searchterm")
strUser = Request.Form("scname")
Response.Write strParm1
Response.Write strParm2
Response.Write strUser
If strSearchterm <> "" then
strSQLWhere = " (DestHost like '%" & strSearchterm & "') "
Else
If strUser <> "" then
strSQLWhere = " (ClientUserName like '%" & strUser & "') "
Else
strSQLWhere = " "
End If
End If
strSQL = " select DISTINCT DestHost " &_
" from WebProxyLog " & _
" where (DestHost like '%" & strSearchterm & "%') " & _
" and (logDate between '" & strParm1 & "' and '" & strParm2 & "') "
strSQLWhere
strSQL2 = " select ClientUserName " &_
" from WebProxyLog " & _
" where (ClientUserName like '%" & strUser & "%') " & _
" and (logDate between '" & strParm1 & "' and '" & strParm2 & "') "
Response.write strSQL
Response.write strSQL2
server.ScriptTimeOut = 600
rst.Open strSQL, con, adOpenKeyset, adLockOptimistic
rst2.Open strSQL2, con, adOpenKeyset, adLockOptimistic
' Only display records if there are records in the recordset
If NOT rst.EOF then
'Display the header
%>
<div align="center">
<p align="center"><b>Internet Destinations </b> </p>
<p align="center"><b>from <%=Request.Form("fdate")%></b></p>
<p align="center"><b>thru <%=Request.Form("tdate")%></b> </p>
<div align="center"><center>
<table BORDER="1" height="57" width="501">
<tr>
<td align="center" height="17" width="491"><b>Destinations</b></td>
</tr>
<%
'Loop through the recordset until there are no more records
Do While Not rst.EOF
%>
<tr>
<td align="center" height="29" width="491"><a href="InternetDestinations4.asp"><%=rst("DestHost")%>
</a></td>
</tr>
<%
'If you forget this next statement, you will be stuck in a loop
rst.MoveNext
Loop
Else
%>
<b>
<tr>
<td align="center" height="23" width="491">No records in recordset! </b>
<%
%>
</td>
</b>
<p></p>
<p></p>
<%
End If
rst.Close
'rst2.Close
con.Close
%></html>
|
|
|
|