473,387 Members | 1,362 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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 2244

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Eugene Anthony | last post by:
Method 1: set rs = Server.CreateObject("ADODB.Recordset") objConn.usp_RetrieveCategories rs Method 2: set rs = objConn.Execute("usp_RetriveCategories") Which method is considered to...
1
by: rvdw | last post by:
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...
5
by: Tim Marshall | last post by:
I was following the thread "Re: Access Treeview - Is it Safe Yet?" with interest and on reading the post describing Lauren Quantrell's SmartTree, I've run into something I don't understand: Stored...
1
by: Ville Huovinen | last post by:
Platform: Windows 2003 Server (MS SQL Server 2003 SP3) Language: C# Problem: My stored procedures times out randomly, some proces works fine when using them from C#, and some generate...
1
by: A1 Ronen | last post by:
Hi all I got problem regarding executing all stored procedure through common procedures where we have different parameter with different names, type and data type The Function is as follows...
3
by: Goog79 | last post by:
Hi everyone, first time here, so I'm sorry if this has been covered already ages ago. :( I am trying to learn T-SQL and Stored Procedures and bought the book on these topics by Djan...
2
by: SQLusername | last post by:
I am having trouble executing a series of 4 stored procedures from VB. The connection code connects and the first 3 stored procedures run through, although the 4th procedure stops running mid...
0
debasisdas
by: debasisdas | last post by:
This thread contains some of the sample code showing the method of executing Oracle stored procedures and functions from VB . Hope the user finds them useful. Oracle Procedure with only IN...
2
by: Carlton Kirby | last post by:
I need to execute a job on a SQL Express 2005 instance (no SQLAgent). The job will be executed manually by a user, so it doesn't need to be scheduled to run automatically. I thought I could...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.