Wrox Home  
Search P2P Archive for: Go

  Return to Index  

activex_data_objects thread: Using parameters multiple times


Message #1 by "Mary S. Martin" <msmartin@g...> on Wed, 17 Apr 2002 23:09:42
Hello all:
I'm using an ADO Command with parameters to run a stored procedure on SQL 
Server 2000.  The problem I'm having is with executing the command 
multiple times with different values for the parameters.

One time through runs fine, after that I get the message that the object 
is no longer valid.  But in my code, I'm not closing any objects until 
after my loop.

All the code examples I've seen just runs the command once when parameters 
are involved.

If you could please point me in the right direction, I would really 
appreciate it!

Thank you,
Mary S. Martin
Message #2 by "David Billingham" <db@p...> on Wed, 17 Apr 2002 23:46:52 +0100
Hi Mary

Please post the code and we can probably help.

I have had problems with doing what you are doing (but not the same
symptoms). The solution I found was that before setting the new values I set
all the parameters to value = NULL before assigning the new values.eg:

For C = 0 To oCmd.Parameters.Count - 1
    oCmd.Parameters(C).Value = Null
Next

Don't know why this worked but it did.

HTH

David


----- Original Message -----
From: "Mary S. Martin" <msmartin@g...>
To: "ActiveX_Data_Objects" <activex_data_objects@p...>
Sent: Wednesday, April 17, 2002 11:09 PM
Subject: [activex_data_objects] Using parameters multiple times


> Hello all:
> I'm using an ADO Command with parameters to run a stored procedure on SQL
> Server 2000.  The problem I'm having is with executing the command
> multiple times with different values for the parameters.
>
> One time through runs fine, after that I get the message that the object
> is no longer valid.  But in my code, I'm not closing any objects until
> after my loop.
>
> All the code examples I've seen just runs the command once when parameters
> are involved.
>
> If you could please point me in the right direction, I would really
> appreciate it!
>
> Thank you,
> Mary S. Martin
>


This e-mail is subject to copyright and the information in it is confidential.  Use of this e-mail or of any information in it other
than by the addressee is unauthorised and unlawful. Please delete this e-mail if you have received it in error.


Message #3 by "Mary S. Martin" <msmartin@g...> on Wed, 17 Apr 2002 15:53:03 -0700
Hi David:
Thanks for the advice on setting parameter values to null.  That's something
I hadn't thought about.

In my case, the problem turned out to be a character parameter that had a
size too small for the data I was trying to push into it.

Thanks again for your help!

Mary S. Martin

----- Original Message -----
From: David Billingham <db@p...>
To: ActiveX_Data_Objects <activex_data_objects@p...>
Sent: Wednesday, April 17, 2002 3:46 PM
Subject: [activex_data_objects] Re: Using parameters multiple times


> Hi Mary
>
> Please post the code and we can probably help.
>
> I have had problems with doing what you are doing (but not the same
> symptoms). The solution I found was that before setting the new values I
set
> all the parameters to value = NULL before assigning the new values.eg:
>
> For C = 0 To oCmd.Parameters.Count - 1
>     oCmd.Parameters(C).Value = Null
> Next
>
> Don't know why this worked but it did.
>
> HTH
>
> David
>
>
> ----- Original Message -----
> From: "Mary S. Martin" <msmartin@g...>
> To: "ActiveX_Data_Objects" <activex_data_objects@p...>
> Sent: Wednesday, April 17, 2002 11:09 PM
> Subject: [activex_data_objects] Using parameters multiple times
>
>
> > Hello all:
> > I'm using an ADO Command with parameters to run a stored procedure on
SQL
> > Server 2000.  The problem I'm having is with executing the command
> > multiple times with different values for the parameters.
> >
> > One time through runs fine, after that I get the message that the object
> > is no longer valid.  But in my code, I'm not closing any objects until
> > after my loop.
> >
> > All the code examples I've seen just runs the command once when
parameters
> > are involved.
> >
> > If you could please point me in the right direction, I would really
> > appreciate it!
> >
> > Thank you,
> > Mary S. Martin
> >
>
>
> This e-mail is subject to copyright and the information in it is
confidential.  Use of this e-mail or of any information in it other than by
the addressee is unauthorised and unlawful. Please delete this e-mail if you
have received it in error.
>
>
>
>


  Return to Index