469,575 Members | 1,680 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,575 developers. It's quick & easy.

executing stored procedures in vb

Hi All,

I've a serious problem with executing stored procedures (SQL2000) from
an Access db (version 97). After executing a stored procedure ,
msaccess hangs. The whole call to the procedure is running fine, but
immediatly after this msaccess hangs, when the focus goes back to the
calling form ?
Has anyone any idea what i can test or look at.

Thanks a lot !!!!!!

CODE*************
Function DownloadData() 'This is the function executed when clicking
on a btn on form
Dim RetVal

RetVal = Execute_Procedure("sp_DownloadData", "", False)
MsgBox "All data has been downloaded "
'UNTIL EVERYTHING IS WORKING FINE BUT WHEN GOING OUT THIS FUNTION
THE ACCESS APPLICATION START USING 100% CPU AND HANGS

End Function


Public Function Execute_Procedure(iProcedure As String, iArgs As
String, iIndicator As Boolean) As Boolean
Dim t1, t2
t1 = Timer

DoCmd.Echo False, "Executing procedure " & iProcedure & " " &
iArgs
Dim oCn As ADODB.Connection
Set oCn = New ADODB.Connection

oCn.ConnectionString = gCn
oCn.Open
oCn.CommandTimeout = 0

Dim oCmd As ADODB.Command
Set oCmd = New ADODB.Command

oCmd.CommandTimeout = 0
oCmd.CommandType = adCmdStoredProc

oCmd.CommandText = iProcedure & iArgs

oCmd.ActiveConnection = oCn

oCmd.Execute , , adExecuteNoRecords

oCn.Close

t2 = Timer

DoCmd.Echo False, iProcedure & " executed in " & CInt((t2 - t1)) &
" seconds"

Set oCmd = Nothing
Set oCn = Nothing

Execute_Procedure = True

End Function
Jul 17 '05 #1
0 2131

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Eugene Anthony | last post: by
5 posts views Thread by Tim Marshall | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.