473,385 Members | 1,740 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Multiple Connections

I've been using ASP.NET for a couple years now and I'm trying to fall back
into ASP for a new position I've acquired...and I'm having a bit of trouble
remembering. I'm running to a problem where the basic logic is as follows:

Query

Do While Not rs.EOF
Query based on value in rs
Another query based on value in rs
Loop

There is no explicit connection object, they all use the same connection
string however. When I limit myself to one query within the Do/Loop, I
don't have any problems. However, when I add another query in there, it
bombs with: Operation is not allowed when the object is open.

I'm assuming it's referring to the connection string being reused, but why
would it allow one additional connection, but not two. I can't really close
this connection before needing to requery. Is there anyway around this, or
am I missing something entirely?

Thanks,
James
Jul 19 '05 #1
8 2000
James Baker wrote on 03 jun 2004 in
microsoft.public.inetserver.asp.general:
Do While Not rs.EOF
Query based on value in rs
Another query based on value in rs
Loop
You will have to increment the rs somwhere in the loop!
There is no explicit connection object, they all use the same
connection string however. When I limit myself to one query within
the Do/Loop, I don't have any problems. However, when I add another
query in there, it bombs with: Operation is not allowed when the
object is open.

I'm assuming it's referring to the connection string being reused, but
why would it allow one additional connection, but not two. I can't
really close this connection before needing to requery. Is there
anyway around this, or am I missing something entirely?


The connnection object is not the same as the query result object

You can make several of the latter.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #2
I'm incrementing the recordset...I figured that was obvious enough that I
could leave it out ;-). The error I'm getting basically a state error,
something about not being able to operate while object is open I believe.
I'll try to find the exact error message.

Jul 19 '05 #3
James Baker wrote on 03 jun 2004 in
microsoft.public.inetserver.asp.general:
I'm incrementing the recordset...I figured that was obvious enough that I
could leave it out
It was ment as a joke
;-).
right.
The error I'm getting basically a state error,
something about not being able to operate while object is open I believe.
I'll try to find the exact error message.


[Please quote a significant [info wize] part of the posting.
This is not email, so others will have to remember the thread's subjects.]

A state error?

We are talking ASP ?

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #4
No, we're talking VBScript ;-). I was referring to the connection's "state"
as in open/closed.
Jul 19 '05 #5
James Baker wrote on 03 jun 2004 in
microsoft.public.inetserver.asp.general:
No, we're talking VBScript ;-). I was referring to the connection's
"state" as in open/closed.


If you do not quote, James, the conversation gets to personal and that is
not the way I want to go in this NG.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #6
James Baker wrote:
I've been using ASP.NET for a couple years now and I'm trying to fall
back into ASP for a new position I've acquired...and I'm having a bit
of trouble remembering. I'm running to a problem where the basic
logic is as follows:

Query

Do While Not rs.EOF
Query based on value in rs
Another query based on value in rs
Loop

There is no explicit connection object, they all use the same
connection string however. When I limit myself to one query within
the Do/Loop, I don't have any problems. However, when I add another
query in there, it bombs with: Operation is not allowed when the
object is open.

I'm assuming it's referring to the connection string being reused,
but why would it allow one additional connection, but not two. I
can't really close this connection before needing to requery. Is
there anyway around this, or am I missing something entirely?

Thanks,
James


I would use an explicit connection object instead of forcing multiple
connections to be opened through the use of connection strings. Are you
using multiple recordset objects?

Dim cn, rs, rs1, rs2
Set cn=sever.createobject("adodb.connection")
cn.open <your connection string>
set rs=cn.execute(<query1>,,1)
do while not rs.eof
set rs1=cn.execute(<query2 based on rs value>,,1)
'do something with rs1
rs1.close
set rs2=cn.execute(<query2 based on rs value>,,1)
'do something with rs2
rs2.close

rs.movenext
loop
rs.close: set rs=nothing
set rs1=nothing
set rs2=nothing
cn.close: set cn= nothing

HTH,
Bob Barrows

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 19 '05 #7
That might be just the ticket I'm looking for...I'll reply after I've tested
it, but thank you very much. I think I had exactly the backward mentality
on this one.

James
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:ua**************@TK2MSFTNGP09.phx.gbl...
James Baker wrote:
I've been using ASP.NET for a couple years now and I'm trying to fall
back into ASP for a new position I've acquired...and I'm having a bit
of trouble remembering. I'm running to a problem where the basic
logic is as follows:

Query

Do While Not rs.EOF
Query based on value in rs
Another query based on value in rs
Loop

There is no explicit connection object, they all use the same
connection string however. When I limit myself to one query within
the Do/Loop, I don't have any problems. However, when I add another
query in there, it bombs with: Operation is not allowed when the
object is open.

I'm assuming it's referring to the connection string being reused,
but why would it allow one additional connection, but not two. I
can't really close this connection before needing to requery. Is
there anyway around this, or am I missing something entirely?

Thanks,
James


I would use an explicit connection object instead of forcing multiple
connections to be opened through the use of connection strings. Are you
using multiple recordset objects?

Dim cn, rs, rs1, rs2
Set cn=sever.createobject("adodb.connection")
cn.open <your connection string>
set rs=cn.execute(<query1>,,1)
do while not rs.eof
set rs1=cn.execute(<query2 based on rs value>,,1)
'do something with rs1
rs1.close
set rs2=cn.execute(<query2 based on rs value>,,1)
'do something with rs2
rs2.close

rs.movenext
loop
rs.close: set rs=nothing
set rs1=nothing
set rs2=nothing
cn.close: set cn= nothing

HTH,
Bob Barrows

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

Jul 19 '05 #8
> Do While Not rs.EOF
Query based on value in rs
Another query based on value in rs
Loop


Chances are you could use JOIN(s) here and avoid all this messy nesting of
resultsets. But we can't tell unless you provide more information.

--
http://www.aspfaq.com/
(Reverse address to reply.)
Jul 19 '05 #9

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

Similar topics

16
by: noah | last post by:
Does PHP have a feature to associate Cookie sessions with a persistent database connection that will allow a single transaction across multiple HTTP requests? Here is how I imagine my process: I...
2
by: Gabriel Jiva | last post by:
I have a Python app, spam.py, that uses a C shared library, eggs.so. This shared library is an interface that makes connections to another system (Ham), and among other things uses callback...
2
by: Paul A. Steckler | last post by:
I need to write a TCP/IP server in C# that can handle multiple connections. My first try was to use TCPListener instances in multiple .NET threads. Of course, I got an exception from...
6
by: Quiet Man | last post by:
Hi all, I'm designing a fairly simple service that will run on W2K/SP4 and W2K3 servers. It's job is to be a very specialized database server that listens on a given IP address / TCP port and...
9
by: Abhishek Srivastava | last post by:
Hello All, In IIS 6.0 We have a concept of worker processes and application pools. As I understand it, we can have multiple worker process per appliction pool. Each worker process is dedicated...
2
by: jasonsgeiger | last post by:
From: "Factor" <jasonsgeiger@gmail.com> Newsgroups: microsoft.public.in.csharp Subject: Multiple Clients, One port Date: Wed, 19 Apr 2006 09:36:02 -0700 I'm been working with sockets for a...
1
by: Yelena Varshal via AccessMonster.com | last post by:
Hello, What are the pre-requisites / conditions for the ability to create multiple connections to MS ACCESS database and what is the precedence of its application? adModeShareDenyNone in the code,...
3
by: D. Yates | last post by:
Hi, I'm about to embark on a project that will both send and receive information to/from our client computers in the field. The area that I still need to finalize is the method of...
4
by: sracherla | last post by:
I am trying to write a simple windows service that accepts an incoming request; receives a string input and sends a string output. I need this connection to stay alive until the client closes it....
35
by: keerthyragavendran | last post by:
hi i'm downloading a single file using multiple threads... how can i specify a particular range of bytes alone from a single large file... for example say if i need only bytes ranging from...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
Oralloy
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,...
0
jinu1996
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...

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.