vfp三层架构问题
vfp三层架构,遇到一个问题请大家帮忙解答一下在同一台机器上web和form1运行没有问题,就是将form1放到另一台机器就不能访问web了,ip地址改了,总是说自定义的方法有错.
下面是生成dll的内容
DEFINE CLASS ChangeCustomer AS Session OLEPUBLIC
DataSession=2 &&私有数据工作期
PROCEDURE Init
SET MULTILOCKS ON
ENDPROC
PROCEDURE GetCustomerInfo HelpString "获取客户信息"
LOCAL oXMLAdapter AS XMLAdapter,oCA AS String,cXML AS String
oCA=CREATEOBJECT("MyCursorAdapter") &&建立CursorAdapter对象
oCA.CursorFill() &&按oCA的Alias属性指定的名称生成临时表
oXMLAdapter=NEWOBJECT("XMLAdapter") &&建立XMLAdapter
oXMLAdapter.AddTableSchema(oCA.Alias) &&加载临时表到XMLAdapter对象
oXMLAdapter.ToXML("cXML") &&生成XML字符串
RELEASE oXMLAdapter,oCA &&释放对象实例
RETURN cXML &&返回XML字符串
ENDPROC
PROCEDURE UpdateCustomer(cXML AS String) HelpString "更新客户信息"
LOCAL oXMLAdapter AS XMLAdapter,oCA AS CursorAdapter
oXMLAdapter=NEWOBJECT("XMLAdapter") &&建立XMLAdapter
oXMLAdapter.UTF8Encoded=.F.
oXMLAdapter.IsDiffGram=.T.
oXMLAdapter.LoadXML(cXML,.F.) &&加载XML
oCA=CREATEOBJECT("MyCursorAdapter")
oXMLAdapter.Tables(1).ChangesToCursor(oCA.Alias) &&还原缓冲表
oCA.CursorAttach(oCA.Alias) &&将还原出的缓冲表与CursorAdapter建立关联
=TABLEUPDATE(.T.) &&发送更新
RELEASE oXMLAdapter,oCA
ENDPROC
PROCEDURE Error(nError AS Integer,cMethod AS String,nLine AS Integer)
LOCAL cText AS String
cText=cMethod+" 错误号="+LTRIM(STR(nError,5))+" 行号="+LTRIM(STR(nLine,8))+" "+MESSAGE()
COMRETURNERROR(cText,_VFP.ServerName)
ENDPROC
ENDDEFINE
*!* 建立基于CursorAdapter的子类,用于连接到SQL Server
DEFINE CLASS MyCursorAdapter AS CursorAdapter
Alias="Customer"
BreakOnError= .F.
DataSourceType="ODBC"
Tables="Customers"
SendUpdates=.T.
AllowDelete=.T.
AllowInsert=.T.
AllowUpdate=.T.
UpdateType=1 &&发送更新方式为UPDATE
WhereType=1 &&Where子句类型为仅由KeyFieldList属性指定的主关键字段组成
KeyFieldList="CustomerID"
UpdatableFieldList="CustomerID, CompanyName"
UpdateNameList="CustomerID Customers.CustomerID, CompanyName
BufferModeOverride= 5 &&开放式表缓存
cConnectionString="Driver={SQL Server};Server=localhost;Uid=sa;Pwd=;Database=northwind"
PROCEDURE Init &&类实例化时直接建立连接
This.DataSource=SQLSTRINGCONNECT(This.cConnectionString, .T.)
This.SelectCmd="SELECT CustomerID, CompanyName FROM Customers"
This.CursorSchema ="CustomerID C(5), CompanyName C(40)"
ENDPROC
FUNCTION Destroy() &&在释放对象时断开与SQL Server的连接
SQLDISCONNECT(This.DataSource)
ENDFUNC
ENDDEFINE
下面是表单form1-command1-click事件
oSoapClient=CREATEOBJECT("MSSOAP.SoapClient30")
oSoapClient.MSSoapInit("http://CCB-ZHJ/FoxWebService/ChangeCustomer.WSDL")
cXML=oSoapClient.GetCustomerInfo() &&获得XML格式的Customers表中的数据
RELEASE oSoapClient
SET MULTILOCKS ON
IF USED("curCustomer") &&关闭表
USE IN curCustomer
ENDIF
*!* 将XML转换为临时表
oXMLAdapter=CREATEOBJECT("XMLAdapter")
oXMLAdapter.LoadXML(cXML,.F.)
oXMLAdapter.Tables(1).Alias="curCustomer"
oXMLAdapter.Tables(1).ToCursor()
SELECT curCustomer
=CURSORSETPROP("Buffering",5)
*!* 设置表格
WITH Thisform.Grid1
.RecordSourceType=1
.RecordSource="curCustomer"
.ColumnCount=2
.Columns(1).Header1.Caption="客户编号"
.Columns(1).ControlSource="curCustomer.CustomerID"
.Columns(1).Width=80
.Columns(2).Header1.Caption="公司名称"
.Columns(2).ControlSource="
.Columns(2).Width=200
ENDWITH
Thisform.Refresh
原文章地址:
http://blog.
它提示GetCustomerInfo()有错,可form1和WEB放在同一台电脑上没有问题,就是将form1放到另一台上就报错