General information
Category:
COM/DCOM and OLE Automation
Title:
VFP Dlls and SQL sp_OACreate Methods
I am trying to call a Visual Foxpro DLL from SQL Server and I am getting errors.
The VFP OLEPUBLIC Class definition is as follows
-------------------------------------------------------------------
Define Class UpdateFox AS custom OLEPUBLIC
lcInputString = SPACE(25)
Function SetInputString
PARAMETERS lcInputString
This.lcInputString = lcInputString
EndFunc
Function GetName
RETURN This.lcInputString
EndFunc
Function Updating
lcInputString = This.lcInputString
lcInputString = STRTRAN(lcInputString, "+", " " ) &&Create Spaces from + signs
lcFOXTable = SUBSTR(lcInputString,1,AT("@",lcInputString,1)-1)
lcSQLString1 = SUBSTR(lcInputString, AT("@",lcInputString,1)+1, (AT("@",lcInputString,2)-AT("@",lcInputString,1))-1)
lcSQLString2 = SUBSTR(lcInputString, AT("@",lcInputString,2)+1, (AT("@",lcInputString,3)-AT("@",lcInputString,2))-1)
lcSQLString3 = SUBSTR(lcInputString, AT("@",lcInputString,3)+1, (AT("@",lcInputString,4)-AT("@",lcInputString,3))-1)
lcFOXPath = SUBSTR(lcInputString, AT("@",lcInputString,4)+1)
CLOSE DATA ALL
USE (lcFOXPath+lcFoxTable) IN 0 SHARED ALIAS nad
lcSQLString = lcSQLString1 + lcSQLString2 + lcSQLString3
&lcSQLString
CLOSE DATA ALL
EndFunc
EndDefine
------------------------------------------------------------------
The following code is executed in the SQL Query Window as a batch (from the master database):
------------------------------------------------------------------
declare @hr int
declare @loSteve int
exec sp_oaCreate 'Steve.UpdateFox', @loSteve output
print @losteve
exec @hr = sp_oaMethod @loSteve, 'SetInputString','nad@update+nad@+set+name=strtran(name,[x],[+])+where+id=[OAK4753]@+@\\jf_lon_srv00\genesis\foxpro2\data\'
print @hr
IF @hr <> 0
BEGIN
EXEC sp_oageterrorinfo @losteve
RETURN
END
-------------------------------------------------------------------
The output received is as follows:
-------------------------------------------------------------------
14367712
-2147211483
[Microsoft][ODBC SQL Server Driver]Protocol error in TDS stream
[Microsoft][ODBC SQL Server Driver]Function sequence error
-------------------------------------------------------------------
What does the Protocol error in TDS stream imply?
Does anyone have any ideas how to implement a VFP DLL in SQL Server 7.0.
I have tried building the DLL both single threaded and multi threaded and receive the same error message.
When I use CREATEOBJECT("Steve.UpdateFox") in VFP, I can run all the updates required, so it is something to do with the way SQL is accessing the DLL.
The DLL is registered and the SQL Server is using a Domain account with Administrator permissions on both the local machine and the domain.
Any help would be greatly appreciated.
Cheers
Steve Lea
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only