1

我正在使用 api / dll 方法。当我运行我的应用程序时,我总是收到此错误“尝试读取或写入受保护的内存。这通常表明其他内存已损坏。”

这是我的代码

charge.CommMethod = PSCharge.CommMethod.TCPIP;
            charge.Port = 31419;
            charge.IPAddress = "192.168.21.139";
            charge.Command = command;
            charge.User = csConfig.pccuser;
            charge.Processor = csConfig.pccprocessor;
            charge.MerchantNumber = csConfig.pccmerchantnum;
            charge.Manual = manual;
            charge.Track = trackdata;
            charge.Amount = amount;
            charge.Card = cardnum;
            charge.ExpDate = expdate;
            charge.member = cardholder;
            charge.Ticket = ticketnumber;
            charge.TroutD = troutd;
            charge.XMLTrans = true;

            PSCharge.FileType filetype = (PSCharge.FileType)3;
            charge.Send(ref filetype);

错误位于这行代码中PSCharge.FileType filetype

PSCharge.FileType

using System;
using System.Runtime.InteropServices;

namespace PSCharge
{
    [Guid("E42FAC74-F294-4FC3-B0BC-89B48BAD769C")]
    public enum FileType
    {
        TTYPE_CLR = 0,
        TTYPE_INP = 1,
        TTYPE_PRO = 2,
        TTYPE_XML = 3,
        TTYPE_INF = 4,
        TTYPE_BCH = 5,
        TTYPE_DUP = 6,
    }
}
4

0 回答 0