I have a function that checks if a ShipTo currently exists: DoesShipToExist(string CustNo, string ShipToNo)
It returns a value indicating if that ShipToNo exists for that customer. In my test database it has always worked correctly. In the production database it sometimes returns a value indicating the ShipTo doesn't exist when apparently it does. This causes a problem because the next step is to add the ShipTo, and then there is an error that the ShipTo already exists.
Here is the code I use for checking if the ShipTo exists (in C#):
For those not familiar with C#, the strFilter variable would equate to something like:
IDCUST = "MyCustNo" AND IDCUSTSHPT = "MyShNo"
I thought maybe I am doing something wrong with the Fetch method, should I be doing the equivalent of a "MoveFirst" with the view before calling Fetch?
It returns a value indicating if that ShipToNo exists for that customer. In my test database it has always worked correctly. In the production database it sometimes returns a value indicating the ShipTo doesn't exist when apparently it does. This causes a problem because the next step is to add the ShipTo, and then there is an error that the ShipTo already exists.
Here is the code I use for checking if the ShipTo exists (in C#):
Code:
AccpacCOMAPI.AccpacDBLink dbLink = null;
dbLink = (AccpacCOMAPI.AccpacDBLink)Application["dbLink"];
// ShipTo view
AccpacView vwShipto = null;
dbLink.OpenView("AR0023", out vwShipto);
// Open a view, filtered for this particular Customer # and Shipto #
string strFilter = "IDCUST = \"" + CustNo + "\" AND IDCUSTSHPT = \""
+ ShipToNo + "\"";
vwShipto.Browse(strFilter, true);
// Does this Shipto exist in the filtered view?
shiptoExists = vwShipto.Fetch();
vwShipto.Close();
For those not familiar with C#, the strFilter variable would equate to something like:
IDCUST = "MyCustNo" AND IDCUSTSHPT = "MyShNo"
I thought maybe I am doing something wrong with the Fetch method, should I be doing the equivalent of a "MoveFirst" with the view before calling Fetch?