473,779 Members | 2,041 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

sp_executesql Operation is not allowed when the object is closed

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.CreateOb ject("ADODB.Con nection")
connInc.Open "DSN=db_databas e;User ID=userid;Passw ord=xxxxxx"
Set rsInc= server.CreateOb ject("ADODB.Rec ordset")
strSQL = "usp_incmpwfilt er_rs 'M9S','2','1',' A,B'" '-these are
string variables passed dependant on asp form selections.
rsInc.Open strSQL, connInc
if not rsInc.eof then ^falls over here

usp_incmpfilter _rs builds a dynamic sql statement which works in query
analyser and passes it to sp_executesql:

CREATE PROCEDURE usp_incmpwfilte r_rs
(
@strPeriodID varchar ,
@intLevelDetail ID varchar,
@intLevelReport ID varchar,
@strFilters varchar
)
AS

set nocount on

declare @strSQL nvarchar

set @strSQL = " SELECT rather complex dynamically built but working in
query analyser SQL statement containing @params goes here: can post if
requested"

execute sp_executesql @strSQL

what am i missing? i have had right nitemare getting this far!!!! any
help much appreciated..
Jul 19 '05 #1
1 4862
> Set connInc= server.CreateOb ject("ADODB.Con nection")
connInc.Open "DSN=db_databas e;User ID=userid;Passw ord=xxxxxx"
Set rsInc= server.CreateOb ject("ADODB.Rec ordset")
strSQL = "usp_incmpwfilt er_rs 'M9S','2','1',' A,B'" '-these are
string variables passed dependant on asp form selections.
rsInc.Open strSQL, connInc
if not rsInc.eof then ^falls over here
You might have better luck trapping EOF by using the connection object
instead of an explicit ADODB.Recordset .

Set connInc = CreateObject("A DODB.Connection ")
connInc.Open "DSN=db_databas e;User ID=userid;Passw ord=xxxxxx"
' consider dropping the DSN! See www.aspfaq.com/2126
strSQL = "usp_incmpwfilt er_rs 'M9S','2','1',' A,B'"
set rsInc = connInc.execute (strSQL)
if not rsInc.EOF then
response.write "there are rows"
else
response.write "there are no rows"
end if
set @strSQL = " SELECT rather complex dynamically built but working in
query analyser SQL statement containing @params goes here: can post if
requested"


As complex is it might be, we're generally pretty smart people, and can
figure it out. Also, could you

PRINT @strSQL

And show us that? (The result, I would think, is far more important than
the method.) It might be that your SQL is malformed, etc.

Also, does this return 1 resultset, 5 resultsets, is it ever possible that
it could be EOF?

microsoft.publi c.inetserver.as p.general dropped from followups.
Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
46911
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');"
17
2729
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 =...
1
655
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:...
2
5065
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
1
2694
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:
8
3007
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...
1
4022
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")
5
2183
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...
1
20646
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"
0
9636
marktang
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...
0
9474
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10074
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,...
0
8961
agi2029
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...
1
7485
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6724
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();...
0
5373
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...
0
5503
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2869
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.