Re: Runtime error 3707
From: SBC (SBC_at_discussions.microsoft.com)
Date: 03/23/05
- Next message: Franklin M. Gauer III: "DataAdapter and Oracle - UpdateStatement Error"
- Previous message: Jerommeke: "Adding relationships between tables using ADODB and ADOX"
- In reply to: mona: "Re: Runtime error 3707"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 23 Mar 2005 11:07:03 -0800
Hello,
Thank you for your response...
I was able to get a hold of the original developer's code and debug through
it...
*** start code snippet...
Dim oCon As ADODB.Connection
Dim oCmd As ADODB.Command
Dim oRs As ADODB.Recordset
' open database connection
Set oCon = InitializeDataAccess() 'They are doing the database
connection here
oCon.CursorLocation = adUseClient
oCon.IsolationLevel = m_iIsolationLevel
Set oCmd = New ADODB.Command
Set oCmd.ActiveConnection = oCon
oCmd.CommandText = sSQL
oCmd.CommandType = adCmdText
If UBound(vArgsParamArray) >= 0 Then
Set oRs = oCmd.Execute(, vArgsParamArray)
Else
Set oRs = oCmd.Execute()
End If
' disconnect recordset
Set oRs.ActiveConnection = Nothing
*** End of code snippet...
after this particualar line "Set oRs = oCmd.Execute(, vArgsParamArray)"
I noticed that oRs has the following error... "Operation is not allowed when
the object is closed"
Before performing the execute, I made sure the database is open...
I know this is what is causing the 3707 error, but now I can't figure out
why we are getting the "Operation is not allowed when the object is closed"
error...
We are trying to run a stored proc... When I run the stored proc manually,
it executes fine.
Thank you
"mona" wrote:
> Hi SBC,
>
> For open Recordset objects or for Recordset objects whose Source property
> is set to a valid Command object, the ActiveConnection property is read-only.
> Otherwise, it is read/write.
>
> So, you need to close your Command object before you close your active connection.
>
> HTH
>
> Mona
>
> "SBC" <SBC@discussions.microsoft.com> wrote in message news:95C72302-15B4-4ABE-B310-D17C8844831F@microsoft.com...
> > Hello,
> >
> > After setting the object below to Nothing, I receive the following runtime
> > error...
> >
> > "The application cannot change the ActiveConnection property of a Recordset
> > object that has a Command object as its source."
> >
> > oRS.ActiveConnection = Nothing
> >
> > The ActiveConnection object is being set to Nothing after executing a stored
> > proc. Would someone be able to give me an idea of why setting the
> > ActiveConnection to Nothing?
> >
> > Thank you very much for you help
> >
> >
- Next message: Franklin M. Gauer III: "DataAdapter and Oracle - UpdateStatement Error"
- Previous message: Jerommeke: "Adding relationships between tables using ADODB and ADOX"
- In reply to: mona: "Re: Runtime error 3707"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|