Click here to Skip to main content
15,888,283 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to integrate data from my sql DB to Sage 300 accpac

When getting PORCP1headerFields.FieldByName("RCPHSEQ")

returns Null object exception error

What I have tried:

C#
public override void InsertInvoiceHeader()
      {
          PORCP1header.Order = 1;
          PORCP1header.Order = 0;



          PORCP1headerFields.FieldByName("RCPHSEQ").SetValue("0", false); // Receipt Sequence Key
          PORCP1header.Init();
          PORCP1header.Order = 1;
          PORCP1detail1.RecordClear();
          PORCP1detail3.RecordClear();
          PORCP1detail4.RecordClear();
          PORCP1detail6.Init();
          PORCP1detail2.Init();
          sRcpSeq = PORCP1headerFields.FieldByName("RCPHSEQ").Value.ToString();
          PORCP1headerFields.FieldByName("RCPNUMBER").SetValue(base.dsHeaders.Tables[0].Rows[base.counterIH]["RCPNUMBER"].ToString(), true); // RECEIPT NUMBER
Posted
Updated 25-Mar-21 22:45pm
v2

1 solution

One of the following is null:
  • PORCP1headerFields
  • PORCP1headerFields.FieldByName("RCPHSEQ")
  • PORCP1headerFields.FieldByName("RCPHSEQ").Value

Based on the information provided, there is no way we can tell you which.

You will need to debug your code to find out which thing is null when it shouldn't be, and then work out how to fix that problem.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900