View Single Post

   
  #4 (permalink)  
Old 02-26-2008, 03:39 PM
Corky
 
Posts: n/a
Default Re: v8.1 - Problem calling SP from UDF

Also, if it is not possible to call a SP that modifies data from an
external UDF, is it allowable for that external UDF to call an .exe
that will connect and execute the SP?

I tried using an OLE Automation library as an external UDF, but I keep
getting errors that I am not allowed to make any connections to the
DB. My VB OLE code follows:

Option Explicit

Dim Conn As Object

Const SQL_TF_OPEN = -1
Const SQL_TF_CLOSE = 1
Const SQL_TF_FETCH = 0


Public Sub solChanged(solutionID As Long, rc As Long, _
insolutionID As Integer, inrc As Integer, _
sqlstate As String, fname As String, fspecname As
String, msg As String, _
scratchpad() As Byte, calltype As Long)

Dim strSQL As String

If (calltype = SQL_TF_OPEN) Then

Set Conn = CreateObject("ADODB.Connection")
Conn.Open "DSN=SUPPORT", "*******", "********"

ElseIf (calltype = SQL_TF_CLOSE) Then
Conn.Close
Set Conn = Nothing

ElseIf (calltype = SQL_TF_FETCH) Then

strSQL = "CALL PROC_UPDATE_NOTIFY(" & solutionID & ",?)"
Conn.Execute strSQL
End If
rc = 0
End Sub

Thanks for your continued help...it sux being a newbie...

-corky
Reply With Quote