Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to avoid (Connection Busy) error when using remote views

Databases and tables

How to avoid (Connection Busy) error when using remote views

by  Steve Bowman  Posted    (Edited  )
Particularly useful when working with large datasets
I created this little function to work with the
CursorGetProp("ConnectHandle",RemoteView)
and
SQLGetProp(nHandle,"ConnectBusy")
functions to pause continued processing until all the data is fetched

Code:
Function GetRemoteView
Parameters DatabaseFile As String, RemoteView As String
lReturnValue=.F.
If Empty(RemoteView) .Or. Type("RemoteView")<>"C" .Or. Empty(DatabaseFile) .Or. Type("DatabaseFile")<>"C"
	Return (lReturnValue)
Endif
If !Dbused(DatabaseFile)
	Open Database (DatabaseFile) Shared
Endif
ctempWorkArea=Select(0)
If Used(RemoteView)
	Use (RemoteView) In (RemoteView)
Else
	Use (RemoteView) In 0
Endif

Select (RemoteView)
Go Bott
nHandle=CursorGetProp("ConnectHandle",RemoteView)
Do While SQLGetProp(nHandle,"ConnectBusy")
	=Inkey(1,"H")
Enddo
If Used(RemoteView)
	Select (RemoteView)
	Go Top
	Select (ctempWorkArea)
	lReturnValue=.T.
Else
	Select (ctempWorkArea)
	lReturnValue=.F.
Endif

Return (lReturnValue)
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top