Welcome to dbFreaks.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

VB6 using ADO, sproc with return recordset

 
   Database Help (Home) -> Visual Basic -> ADO RSS
Next:  DAO 3.6 record locking  
Author Message
jim

External


Since: Feb 17, 2005
Posts: 3



(Msg. 1) Posted: Thu Feb 17, 2005 2:19 pm
Post subject: VB6 using ADO, sproc with return recordset
Archived from groups: microsoft>public>vb>database>ado (more info?)

VB6 code snippet:

with cmd
.cmdtext = "exec buildwordlist 11"
.commandtype = adcmdtext
end with
set rs = cmd.execute()
if not rs.eof then
strfield = rs!fieldname
rs.movenext
end if

the above code works just fine if the sproc is a simple select * from
tblword and returns records.

However, if the sproc is changed to include a temp table (#tempwords) for
filtering the word list before returning a recordset, it throws a 3704 error,
"operation not allowed when the object is closed". This makes no sense to me.

If I run this as a pass-through query using ODBC, it works just fine. I
want to use ADO and not ODBC.

Please suggest a solution.

Thanks,
Jim

 >> Stay informed about: VB6 using ADO, sproc with return recordset 
Back to top
Login to vote
Mark J. McGinty

External


Since: Aug 31, 2003
Posts: 30



(Msg. 2) Posted: Fri Feb 18, 2005 11:06 am
Post subject: Re: VB6 using ADO, sproc with return recordset [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"jim" wrote in message

 > VB6 code snippet:
 >
 > with cmd
 > .cmdtext = "exec buildwordlist 11"
 > .commandtype = adcmdtext
 > end with
 > set rs = cmd.execute()
 > if not rs.eof then
 > strfield = rs!fieldname
 > rs.movenext
 > end if
 >
 > the above code works just fine if the sproc is a simple select * from
 > tblword and returns records.
 >
 > However, if the sproc is changed to include a temp table (#tempwords) for
 > filtering the word list before returning a recordset, it throws a 3704
 > error,
 > "operation not allowed when the object is closed". This makes no sense to
 > me.
 >
 > If I run this as a pass-through query using ODBC, it works just fine. I
 > want to use ADO and not ODBC.
 >
 > Please suggest a solution.
 >
 > Thanks,
 > Jim

You either need to add SET NOCOUNT ON at the top of your stored procedure,
or walk through the returned recordset[s] by calling NextRecordset until it
returns a recordset object that has it's State property set to 1, or it
returns Nothing.

Without SET NOCOUNT ON, it returns a recordset for every SQL statement
that's executed in the procedure. With it, only statements that return rows
(or could return rows, to be more precise) generate a recordset.


-Mark

 >> Stay informed about: VB6 using ADO, sproc with return recordset 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
updatable ado-recordset - Hi, In the code below i have an updatable ado-recordset. However it is not working how i thought it would be. Maybe someone can help me out here? The global connection (Thanks to Brendan): Option Compare Database Option Explicit Public mconn As..

ADO recordset question - Hello all. This is such a basic question, but I can't find an answer. I have a function in a class module that finds data from a series of database tables. The data, when found, is placed into a new recordset within the function. All OK here. Now, wher...

ADODB.RecordSet - Hi, I have a client recordset returned via VB6. I'd like to know if it can be inserted to a phisical table on MS SQL SERVER containing the same fields...? It'd be like a "INSERT SELECT", but the source (select) would come from this adodb.rec...

Recordset-adding to a Listview - I've got a weird problem - - - it must be something simple, but for the life of me, I must be missing it... I've got a recordset - and I'm trying to add the results into a listview, but, instead of adding each successive record after the first line of....

Updating An ADO 2.6 Recordset With VB and Access - When I try to update my ADO Recordset like this: recSet.Fields(2).Value = strFileNum I get this: Current Recordset does not support updating. This may be a limitation of the provider, or of the selected locktype. Error 3251 When I try t...
   Database Help (Home) -> Visual Basic -> ADO All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]