I
isaac2004
hi i am trying to use the record count object to count the number of
books in a database of mine. i get this error saying that i have closed
the object and i dont think i closed it. here is my code
<% dim strBrowse, strSearch, Count
Count = objRS.RecordCount
strBrowse = request.querystring("strBrowse")
strSearch = request.querystring("strSearch")
if strBrowse > "" then
strSQL = "SELECT distinctrow tblCategories.strCategory,
tblBookDescription.ISBN, tblBookDescription.strTitle,
tblBookDescription.strDescription " & _
"FROM tblBookDescription INNER JOIN tblCategories ON
tblBookDescription.ISBN = tblCategories.ISBN " & _
"Where (((tblCategories.strCategory) = '" & strBrowse &
"')) " & _
"ORDER BY tblBookDescription.strTitle "
End If
if strSearch > "" then
strSQL= "SELECT distinctrow tblBookDescription.strTitle,
tblBookDescription.strDescription, tblBookDescription.ISBN " & _
"FROM tblAuthors INNER JOIN (tblBookDescription INNER JOIN
tblAuthorsBooks ON tblBookDescription.ISBN = tblAuthorsBooks.ISBN) ON
tblAuthors.AuthorID = tblAuthorsBooks.AuthorID "&_
"WHERE ((tblAuthors.strLastName Like '%"&strSearch&"%') "& _
"OR (tblAuthors.strFirstName Like '%"&strSearch&"%') "&_
"OR (tblBookDescription.strTitle Like '%"&strSearch&"%') "&_
"OR (tblBookDescription.strDescription Like '% "&strSearch&"
%') "& _
"OR (tblBookDescription.strPublisher Like '%"&strSearch&"%'))
"&_
"ORDER BY tblBookDescription.strTitle;"
end if
'response.write("strSQL = " & strSQL)
Set objRS = Server.CreateObject("ADODB.Recordset")
-----------------------------------------------------------------------------error
here
objRS.open strSQL, objConn, 1, objRS.RecordCount
%>
</td>
<td valign="top"><font face="Comic Sans MS" color="blue">
<%
if strBrowse > "" and Count = 1 then
response.write("We Carry " & Count & " " & strBrowse & "
book.")
else if strBrowse > "" and Count > 1 then
response.write("We Carry " & Count & " " & strBrowse & "
books.")
end if
end if
if strSearch > "" and Count = 1 then
response.write("Search results: " & Count & " book matches '"
& strSearch & "'.")
else if strSearch > "" and Count > 1 then
response.write("Search results: " & Count & " books match '" &
strSearch & "'.")
end if
end if
%>
thanks for the help
books in a database of mine. i get this error saying that i have closed
the object and i dont think i closed it. here is my code
<% dim strBrowse, strSearch, Count
Count = objRS.RecordCount
strBrowse = request.querystring("strBrowse")
strSearch = request.querystring("strSearch")
if strBrowse > "" then
strSQL = "SELECT distinctrow tblCategories.strCategory,
tblBookDescription.ISBN, tblBookDescription.strTitle,
tblBookDescription.strDescription " & _
"FROM tblBookDescription INNER JOIN tblCategories ON
tblBookDescription.ISBN = tblCategories.ISBN " & _
"Where (((tblCategories.strCategory) = '" & strBrowse &
"')) " & _
"ORDER BY tblBookDescription.strTitle "
End If
if strSearch > "" then
strSQL= "SELECT distinctrow tblBookDescription.strTitle,
tblBookDescription.strDescription, tblBookDescription.ISBN " & _
"FROM tblAuthors INNER JOIN (tblBookDescription INNER JOIN
tblAuthorsBooks ON tblBookDescription.ISBN = tblAuthorsBooks.ISBN) ON
tblAuthors.AuthorID = tblAuthorsBooks.AuthorID "&_
"WHERE ((tblAuthors.strLastName Like '%"&strSearch&"%') "& _
"OR (tblAuthors.strFirstName Like '%"&strSearch&"%') "&_
"OR (tblBookDescription.strTitle Like '%"&strSearch&"%') "&_
"OR (tblBookDescription.strDescription Like '% "&strSearch&"
%') "& _
"OR (tblBookDescription.strPublisher Like '%"&strSearch&"%'))
"&_
"ORDER BY tblBookDescription.strTitle;"
end if
'response.write("strSQL = " & strSQL)
Set objRS = Server.CreateObject("ADODB.Recordset")
-----------------------------------------------------------------------------error
here
objRS.open strSQL, objConn, 1, objRS.RecordCount
%>
</td>
<td valign="top"><font face="Comic Sans MS" color="blue">
<%
if strBrowse > "" and Count = 1 then
response.write("We Carry " & Count & " " & strBrowse & "
book.")
else if strBrowse > "" and Count > 1 then
response.write("We Carry " & Count & " " & strBrowse & "
books.")
end if
end if
if strSearch > "" and Count = 1 then
response.write("Search results: " & Count & " book matches '"
& strSearch & "'.")
else if strSearch > "" and Count > 1 then
response.write("Search results: " & Count & " books match '" &
strSearch & "'.")
end if
end if
%>
thanks for the help