Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / Database Access / January 2005



Tip: Looking for answers? Try searching our database.

Command Object and Stored Procedures

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JLFleming - 31 Jan 2005 17:54 GMT
I have a stored procedure I want to run several times in
the same routine.  Below is how I am calling the stored
procedure.

How can I run the stored procedure the second time with
new parameters?  The way I am doing it is setting the
cmdTest = Nothing and then recreating it.

Is there a better way to do it?

With cmdTest
 .ActiveConnectin dbcon
 .CommandType = adCmdStoredProc
 .CommandText = "stored_Proc"
 .Parameters.Append .CreateParameter(...)
 .Parameters.Append .CreateParameter(...)
 .Execute
End With

Thank you,
JLFleming
       
Paul Clement - 31 Jan 2005 18:13 GMT
¤
¤ I have a stored procedure I want to run several times in
¤ the same routine.  Below is how I am calling the stored
¤ procedure.
¤
¤ How can I run the stored procedure the second time with
¤ new parameters?  The way I am doing it is setting the
¤ cmdTest = Nothing and then recreating it.
¤
¤ Is there a better way to do it?
¤
¤ With cmdTest
¤   .ActiveConnectin dbcon
¤   .CommandType = adCmdStoredProc
¤   .CommandText = "stored_Proc"
¤   .Parameters.Append .CreateParameter(...)
¤   .Parameters.Append .CreateParameter(...)
¤   .Execute
¤ End With

Have you tried changing the Value property of each Parameter in the Parameters collection and then
executing the command?

Paul ~~~ pclement@ameritech.net
Microsoft MVP (Visual Basic)
anonymous@discussions.microsoft.com - 31 Jan 2005 18:37 GMT
>-----Original Message-----
>
[quoted text clipped - 20 lines]
>Have you tried changing the Value property of each Parameter in the Parameters collection and then
>executing the command?

Do you mean this:
With cmdTest
  .Parameters.Item(0).Value = ...
  .Parameters.Item(1).Value = ...
  .Execute
End With

Thank you,
Jennifer

>Paul ~~~ pclement@ameritech.net
>Microsoft MVP (Visual Basic)
>.
Paul Clement - 31 Jan 2005 19:43 GMT
¤
¤ >-----Original Message-----
¤ >On Mon, 31 Jan 2005 09:54:27 -0800, "JLFleming"
¤ >
¤ >¤
¤ >¤ I have a stored procedure I want to run several times
¤ in
¤ >¤ the same routine.  Below is how I am calling the
¤ stored
¤ >¤ procedure.
¤ >¤
¤ >¤ How can I run the stored procedure the second time
¤ with
¤ >¤ new parameters?  The way I am doing it is setting the
¤ >¤ cmdTest = Nothing and then recreating it.
¤ >¤
¤ >¤ Is there a better way to do it?
¤ >¤
¤ >¤ With cmdTest
¤ >¤   .ActiveConnectin dbcon
¤ >¤   .CommandType = adCmdStoredProc
¤ >¤   .CommandText = "stored_Proc"
¤ >¤   .Parameters.Append .CreateParameter(...)
¤ >¤   .Parameters.Append .CreateParameter(...)
¤ >¤   .Execute
¤ >¤ End With
¤ >
¤ >Have you tried changing the Value property of each
¤ Parameter in the Parameters collection and then
¤ >executing the command?
¤
¤ Do you mean this:
¤ With cmdTest
¤    .Parameters.Item(0).Value = ...
¤    .Parameters.Item(1).Value = ...
¤    .Execute
¤ End With
¤
¤ Thank you,
¤ Jennifer

Yes I did.

Paul ~~~ pclement@ameritech.net
Microsoft MVP (Visual Basic)
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.