添加Interop.RTXServerApi.dll的引用
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using RTXServerApi; using System.Runtime.InteropServices; namespace OtherObj { public partial class ExportUserDatafrm : Form { public ExportUserDatafrm() { InitializeComponent(); } private void btnExportDataToRTX_Click(object sender, EventArgs e) { RTXServerApi.RTXObjectClass RTXObj = new RTXObjectClass(); //创建一个业务逻辑对象 RTXServerApi.RTXCollectionClass RTXParams = new RTXCollectionClass();// 创建一个集合对象 RTXObj.ServerIP = "127.0.0.1"; RTXObj.ServerPort = 6000; RTXObj.Name = "USERSYNC"; //业务逻辑对象名称为用户数据同步 RTXParams.Add("MODIFYMODE", 1); //"<?xml version=""1.0"" encoding=""gb2312"" ?>" //<?xml version="1.0" encoding="gb2312" ?> RTXParams.Add("XMLENCODE", @"<?xml version=" + "\"" + "1.0" + "\"" + " encoding=" + "\"" + "gb2312" + "\"" + " ?>"); try { object rtxData = RTXObj.Call2(enumCommand_.PRO_SYNC_FROM_RTX, RTXParams); //object rtxData = RTXObj.Call2(enumCommand_.PRO_GETALLDPETINFO, RTXParams); richTextBox1.Text = rtxData.ToString(); MessageBox.Show("导出成功"); } catch (COMException ex) { MessageBox.Show(ex.Message); } } } }
原文:http://www.cnblogs.com/guohu/p/4917460.html