ADO Command Object Error 3711 Invalid Operation 
Author Message
 ADO Command Object Error 3711 Invalid Operation

Hi:
I'm new to ADO. With VB  and Access,I am trying to Select records from
a table using
RecordsetObject.open ("Select * from ....")and later INSERT the
recorset values into a another table. I am using a Command object to
INSERT.

I set the command Text,type,activeconnection etc.

I get a runtime error'3711' at the INSERT statment.
says "Invalid Operation on Object While processing another command"

Why is this?This occurs only when i run the program using f5...during
step by step exec( F8) it runs without errors.

I have used the same ADO conn for both the Recorset and Command
Objects.Is this right? Should I release any object to Close or nothing?

Also  This error occurs for the second record in the loop for Inserting.
The first record gets INSERTED well.

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Sun, 28 Jul 2002 03:00:00 GMT  
 ADO Command Object Error 3711 Invalid Operation

Quote:

>Hi:
>I'm new to ADO. With VB  and Access,I am trying to Select records from
>a table using
>RecordsetObject.open ("Select * from ....")and later INSERT the
>recorset values into a another table. I am using a Command object to
>INSERT.

>I set the command Text,type,activeconnection etc.

>I get a runtime error'3711' at the INSERT statment.
>says "Invalid Operation on Object While processing another command"

>Why is this?This occurs only when i run the program using f5...during
>step by step exec( F8) it runs without errors.

>I have used the same ADO conn for both the Recorset and Command
>Objects.Is this right? Should I release any object to Close or nothing?

No - you should be able to use a single connection for everything.
Quote:
>Also  This error occurs for the second record in the loop for Inserting.
>The first record gets INSERTED well.

I am getting the impression you are changing the commandtext? Hmm..
Anyway, this is how I would do something like this:

comm.activeconnection = conn
comm.commandtype=1
comm.commandtext = "insert into tableB(field1,field2,field3) " & _
        "values (?,?,?)"
comm.prepared=true
rs.open "select field1,field2,field3 from tableA", conn, _
        adOpenStatic, adLockReadOnly
do while not rs.eof
        cmd.execute iNum,array(rs.fields(0).value,rs.fields(1).value, _
                rs.fields(2).value)
        rs.movenext
loop
rs.close

HTH,

Dan Bush
Battle Ground.wa.us
Please No Spam, to email, change .com to .net



Sun, 28 Jul 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Problems after Upgrade 4.00.3711.08 to 4.00.5303.01

2. Command Object-Type name invalid error

3. Invalid operation on closed object

4. '3709': Operation is not allowed on an object referencing a closed or invalid connection

5. Invalid Operation Error

6. field.properties.append -- Invalid Operation error?

7. error 3219: invalid operation

8. Error 40020: Invalid operation at current state.

9. Error Using ADO Command object

10. Ado Command Object reports error

11. Error using the Command-object of ADO

12. Operation of children command in ADO

 

 
Powered by phpBB® Forum Software