How to check if sproc has finished

R

Robert

I have an Access 2007 ADP database using SQL Server 2008 Express and I need
to run several queries in succession. I am using code such as

Docmd.RunSQL "Exec sproc1 @p1, @p2 etc....
Docmd.RunSQL "Exec sproc2 @p1, @p2 etc....

I need to have some way to test if the first one has finished before the
second one starts. How can I do this?
 
B

Bob McClellan

Robert,
I would use ADO with an output param to get results.
If you opt not to do that then why not have one stored proc that
executes the others....

Create Proc sproc_Main
@p1 int --(or whatever),
@p2 int --(or whatever)
as
exec dbo.sproc1 @p1, @p2 etc....
exec dbo.sproc2 @p1, @p2 etc....


...bob
 
R

Robert

Robert,
I would use ADO with an output param to get results.
If you opt not to do that then why not have one stored proc that
executes the others.... ADO? How would I use ADO?

Create Proc sproc_Main
@p1 int --(or whatever),
@p2 int --(or whatever)
as
exec dbo.sproc1 @p1, @p2 etc....
exec dbo.sproc2 @p1, @p2 etc....


..bob
 
B

Bob McClellan

ADO? How would I use ADO?
here is an example...

Dim oCmd As Command, param As Parameter
Dim cn As New ADODB.Connection, sqlString As String

sqlString = "NewJobSites_CheckCount" 'PROC:
NewJobSites_CheckCount
Set oCmd = New ADODB.Command
Set cn = CurrentProject.Connection
Set oCmd.ActiveConnection = cn
oCmd.CommandText = sqlString
oCmd.CommandType = adCmdStoredProc
oCmd.CommandTimeout = 15


Set param = New ADODB.Parameter
param.Type = adInteger
param.Direction = adParamOutput
param.Name = "cnt" 'RETURN: Authenticated Flag
oCmd.Parameters.Append param

Me.JobCount = oCmd.Parameters("cnt")
oCmd.Execute , , adExecuteNoRecords

Set cn = Nothing
 
M

Marco

Friends and friends around the world.
We are presenting the new messenger.
He will be in the commissioning by the friends that we indicate to use the
system.
Access the system by clicking the link below and register free.

You get something for using orkut?
You get something for using skype?
You gain something by using twiter?
You get algumaocisa for using facebook?

Enjoy this is your time!!

Sign up and join for free.


http://www.sqipcom.com/?ref=webempreendedor

http://stakeholder.sqipcom.com/user/webempreendedor
 
R

Robert

Thanks. So if an sproc calls 2 other sprocs the second one doesn't start
until the first one has finished?
 
V

vaslerio

Robert said:
I have an Access 2007 ADP database using SQL Server 2008 Express and I
need
to run several queries in succession. I am using code such as

Docmd.RunSQL "Exec sproc1 @p1, @p2 etc....
Docmd.RunSQL "Exec sproc2 @p1, @p2 etc....

I need to have some way to test if the first one has finished before the
second one starts. How can I do this?
 
G

Guest

Robert said:
I have an Access 2007 ADP database using SQL Server 2008 Express and I
need
to run several queries in succession. I am using code such as

Docmd.RunSQL "Exec sproc1 @p1, @p2 etc....
Docmd.RunSQL "Exec sproc2 @p1, @p2 etc....

I need to have some way to test if the first one has finished before the
second one starts. How can I do this?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top