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.RecordCou nt
strBrowse = request.queryst ring("strBrowse ")
strSearch = request.queryst ring("strSearch ")
if strBrowse > "" then
strSQL = "SELECT distinctrow tblCategories.s trCategory,
tblBookDescript ion.ISBN, tblBookDescript ion.strTitle,
tblBookDescript ion.strDescript ion " & _
"FROM tblBookDescript ion INNER JOIN tblCategories ON
tblBookDescript ion.ISBN = tblCategories.I SBN " & _
"Where (((tblCategorie s.strCategory) = '" & strBrowse &
"')) " & _
"ORDER BY tblBookDescript ion.strTitle "
End If
if strSearch > "" then
strSQL= "SELECT distinctrow tblBookDescript ion.strTitle,
tblBookDescript ion.strDescript ion, tblBookDescript ion.ISBN " & _
"FROM tblAuthors INNER JOIN (tblBookDescrip tion INNER JOIN
tblAuthorsBooks ON tblBookDescript ion.ISBN = tblAuthorsBooks .ISBN) ON
tblAuthors.Auth orID = tblAuthorsBooks .AuthorID "&_
"WHERE ((tblAuthors.st rLastName Like '%"&strSearch&" %') "& _
"OR (tblAuthors.str FirstName Like '%"&strSearch&" %') "&_
"OR (tblBookDescrip tion.strTitle Like '%"&strSearch&" %') "&_
"OR (tblBookDescrip tion.strDescrip tion Like '% "&strSearch &"
%') "& _
"OR (tblBookDescrip tion.strPublish er Like '%"&strSearch&" %'))
"&_
"ORDER BY tblBookDescript ion.strTitle;"
end if
'response.write ("strSQL = " & strSQL)
Set objRS = Server.CreateOb ject("ADODB.Rec ordset")
-----------------------------------------------------------------------------error
here
objRS.open strSQL, objConn, 1, objRS.RecordCou nt
%>
</td>
<td valign="top"><f ont 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 1 3410
I believe the last parameter to Open should be a 3 for a dynamic recordset.
objRS.open strSQL, objConn, 1, 3
next, this line of code :
Count = objRS.RecordCou nt
is being called before the recordset is open, thus the RS is not OPEN yet...
D.
isaac2004 wrote: 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
strBrowse = request.queryst ring("strBrowse ") strSearch = request.queryst ring("strSearch ")
if strBrowse > "" then strSQL = "SELECT distinctrow tblCategories.s trCategory, tblBookDescript ion.ISBN, tblBookDescript ion.strTitle, tblBookDescript ion.strDescript ion " & _ "FROM tblBookDescript ion INNER JOIN tblCategories ON tblBookDescript ion.ISBN = tblCategories.I SBN " & _ "Where (((tblCategorie s.strCategory) = '" & strBrowse & "')) " & _ "ORDER BY tblBookDescript ion.strTitle "
End If if strSearch > "" then strSQL= "SELECT distinctrow tblBookDescript ion.strTitle, tblBookDescript ion.strDescript ion, tblBookDescript ion.ISBN " & _ "FROM tblAuthors INNER JOIN (tblBookDescrip tion INNER JOIN tblAuthorsBooks ON tblBookDescript ion.ISBN = tblAuthorsBooks .ISBN) ON tblAuthors.Auth orID = tblAuthorsBooks .AuthorID "&_ "WHERE ((tblAuthors.st rLastName Like '%"&strSearch&" %') "& _ "OR (tblAuthors.str FirstName Like '%"&strSearch&" %') "&_ "OR (tblBookDescrip tion.strTitle Like '%"&strSearch&" %') "&_ "OR (tblBookDescrip tion.strDescrip tion Like '% "&strSearch &" %') "& _ "OR (tblBookDescrip tion.strPublish er Like '%"&strSearch&" %')) "&_ "ORDER BY tblBookDescript ion.strTitle;" end if
'response.write ("strSQL = " & strSQL)
Set objRS = Server.CreateOb ject("ADODB.Rec ordset") -----------------------------------------------------------------------------error here objRS.open strSQL, objConn, 1, objRS.RecordCou nt %> </td> <td valign="top"><f ont 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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Matthew Louden |
last post by:
The following ASP code yields the following error, but actually the new
record is stored
in database. The same error happens when the application deletes a record,
such as
sqlStmt ="delete from test where username='2323'" Any ideas? Thanks!
<%
Dim objRS, sqlStmt
Set objRS = Server.CreateObject ("ADODB.Recordset")
sqlStmt = "insert into test VALUES ('2341', '2341');"
|
by: cliverama |
last post by:
help! fried brains....
asp calling a sqlserver7 stored proc which dynamically builds a
sqlstatement & passes it to sp_executesql
asp page gives the operation not allowed when object is closed error
this is the asp code:
Set connInc= server.CreateObject("ADODB.Connection")
connInc.Open "DSN=db_database;User ID=userid;Password=xxxxxx"
Set rsInc= server.CreateObject("ADODB.Recordset")
|
by: James Baker |
last post by:
I'm getting an error: "Operation is not allowed when the object is closed."
on the lines of code below. I can't imagine why the object would be closed
where it says it will be, I've just opened it on the line before. This is
all within a larger loop, but the loop seems to be working fine and other
insert statements within it seem ok. Any suggestions?
Dim cmsRS, cmsSQL
Dim insRS, insSQL
Set cmsRS =...
|
by: |
last post by:
So, I am getting this really annoying error.. the SQL Statement executes
perfectly in Query Analyzer.. all I am doing is basically duplicating a row
(insert into select from) from one table back into itself. This is so that
people can duplicate a report definition and then edit.. Basically i store
the XMLDATA property of the OWC in a SQL table and have a couple of pages
for finding report defs.. not too complex..
Error Type:...
|
by: Arpan |
last post by:
An ASP application updates a SQL Server database table after a Form is
submitted after which the user is directed to another page that should
display the updated records. If the code is
----------------------------------------
'records get updated here
Response.Redirect("Records.asp")
objRS.Close
Set objRS=Nothing
| |
by: amitbadgi |
last post by:
Hello guys I am getting this error while converting an asp applicayion
to asp.net
Exception Details: System.Runtime.InteropServices.COMException:
Operation is not allowed when the object is closed.
Source Error:
Line 168: rs =
Server.CreateObject("ADODB.recordset")Line 169:
|
by: Jim in Arizona |
last post by:
I've been using an example out of a book to be able to edit the rows in a
database. I am getting the following error:
========================================================
========================================================
Server Error in '/' Application.
--------------------------------------------------------------------------------
Operation must use an updateable query.
Description: An unhandled exception occurred during...
|
by: Matt |
last post by:
Got this problem that killing me...what am i doing wrong with this old
dll. When i call the function from asp i get "Operation is not allowed
when object is closed"
any clue will be appriciated....
test .asp
<%
dim oObj
dim a
set oObj= server.CreateObject("MyDll.MyClass")
|
by: Sonasang |
last post by:
Hi ,
I am creating a web page with ASP and Javascript.We have shared the foldres containg the code and all our team members are accessing the code.
There is no problem for me when i run the code and working properly. But when some of my team members when they run the web page they are getting the ERROR in function() Operation is not allowed when the object is closed.
In the login page there in no problem, After we login in the page...
|
by: Ryan Liu |
last post by:
Hi,
I have a 100 clients/ one server application, use ugly one thread pre client
approach. And both side user sync I/O.
I frequently see the error on server side(client side code is same, but I
don't see the error):
"System.IO.IOException: Unable to read data from the transport connection:A
blocking operation was interrupted by a call to WSACancelBlockingCall"
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |