您的位置:首页 > 编程语言 > ASP

asp.net 调用SAP RFC(基于sap.connector.dll和sap.connector.rfc.dll)

2012-10-23 22:31 453 查看
SAP.Connector.SAPConnection myConn;
SAP.Connector.SAPLogonDestination myDest;
myDest = new SAP.Connector.SAPLogonDestination();
myDest.Client = 100;
myDest.AppServerHost = "192.168.1.1";
myDest.SystemNumber = "80";
myDest.Username = "yubofighting";
myDest.Password = "*****";
myDest.Language = "ZH";
myConn = new SAP.Connector.SAPConnection(myDest);
myConn.Open();

当我们用上面的代码连接SAP的时候,会提示myDest.AppServerHost和myDest.SystemNumber是只读(read only)的,主要原因是

SAP.Connector.SAPLogonDestination取的是本地SAPLogin.ini配置文件中的值,SAPLogin.ini中已经配置了服务器地址和实例编号,所以不需要再写入程序

如果需要自定义,只要将SAP.Connector.SAPLogonDestination修改成SAP.Connector.Destination就可以了:

SAP.Connector.SAPConnection myConn;
SAP.Connector.SAPLogonDestination myDest;
myDest = new SAP.Connector.SAPLogonDestination();
myDest.Client = 100;
myDest.AppServerHost = "192.168.1.1";
myDest.SystemNumber = "80";
myDest.Username = "yubofighting";
myDest.Password = "*****";
myDest.Language = "ZH";
myConn = new SAP.Connector.SAPConnection(myDest);
myConn.Open();


好,上面连接SAP都没有问题了,发布到WIN2003或者WIN2000上面,问题又来了,出现以下错误:

Unable to load DLL 'librfc32.dll'

这是由于WIN2003和WIN2000的system32的文件夹下面没有librfc32.dll这个文件,

将本机电脑上的system32下面的librfc.dll文件copy到服务器system32文件夹下就可以了
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: