Use RDO to Access Stored Functions and Procedures on a Server

This code illustrates a VB5 routine that calls a given server’s stored functions or procedures. The first parameter is the stored function procedure name that resides on the server (ORACLE, SQL Server, and so on). The second parameter is a dynamic array that takes an arbitrary number of input arguments for the stored function or procedure. It returns data from the server:

 Public db As rdoEnginePublic en As rdoEnvironmentPublic cn1 As rdoConnectionPublic Function Get_STOREDFUN(sFun As String, ParamArray _	sColumns() As Variant) As Variant [rdoResultset]	Dim sSQL As String	Dim Rs As rdoResultset	Dim Qry As rdoQuery	Dim X As Integer	sSQL = "{ ? = Call " & sFun	If UBound(sColumns) = -1 Then		'Do Nothing here	Else			sSQL = sSQL & " ("		For X = 0 To UBound(sColumns)			sSQL = sSQL & "?,"		Next			sSQL = Left(sSQL, Len(sSQL) - 1) & ")"	End If 	sSQL = sSQL & " }"	Set Qry = cn1.CreateQuery("doFunction", sSQL)	Qry(0).Direction = rdParamReturnValue	For X = 0 To UBound(sColumns)		Qry(X + 1).Direction = rdParamInput		Qry.rdoParameters(X + 1) = sColumns(X)	Next	Set Rs = Qry.OpenResultset(rdOpenForwardOnly, _		rdConcurReadOnly)	Get_STOREDFUN = Qry(0)[Set Get_STOREDFUN = Rs]End Function

If you have three stored functions in a server, each one takes a different number of input arguments. You can call the same VB5 routine to get returning data:

 	sPrdPlant  = Get_STOREDFUN("ZIP_2PLANT", CStr(txtZip))	sControl   = Get_STOREDFUN("CONTRNUM")	fItemPrice = Get_STOREDFUN("GET_UnitPrice", Cstr(prd), _		Clng(qty))
Share the Post:
Share on facebook
Share on twitter
Share on linkedin


The Latest

your company's audio

4 Areas of Your Company Where Your Audio Really Matters

Your company probably relies on audio more than you realize. Whether you’re creating a spoken text message to a colleague or giving a speech, you want your audio to shine. Otherwise, you could cause avoidable friction points and potentially hurt your brand reputation. For example, let’s say you create a

chrome os developer mode

How to Turn on Chrome OS Developer Mode

Google’s Chrome OS is a popular operating system that is widely used on Chromebooks and other devices. While it is designed to be simple and user-friendly, there are times when users may want to access additional features and functionality. One way to do this is by turning on Chrome OS

homes in the real estate industry

Exploring the Latest Tech Trends Impacting the Real Estate Industry

The real estate industry is changing thanks to the newest technological advancements. These new developments — from blockchain and AI to virtual reality and 3D printing — are poised to change how we buy and sell homes. Real estate brokers, buyers, sellers, wholesale real estate professionals, fix and flippers, and beyond may