Successfully used web service (NAV 2009 SP1) to add records to two tables. However, fields that are either date, integer or decimal are not being updated with the values assigned to the fields in the C# application.
Here is an extract of the code:
// Create an instance of Shopping Cart Header
ShoppingCartHeader SCHeader = new ShoppingCartHeader();
SCHeader.Shopping_Cart_No = "1234H";
SCHeader.Customer_Name = "Mary Jones";
SCHeader.Address = "1234 Bermuda Drive";
SCHeader.City = "Chicago";
System.DateTime orddate = new DateTime(2009, 9, 30);
SCHeader.Order_Date = orddate;
SCHeader.State = "IL";
SCHeader.ZipCode = "60609";
// Create an instance of Shopping Cart Line array
ShoppingCartLine[] SCLineArray = new ShoppingCartLine[4];
for (int i = 0; i < SCLineArray.Length; i++)
{
decimal j;
SCLineArray = new ShoppingCartLine();
SCLineArray.Shopping_Cart_No = SCHeader.Shopping_Cart_No;
SCLineArray.Line_No = (i+1) * 10000;
SCLineArray.Shopping_Cart_No += SCLineArray.Line_No.ToString();
j = (decimal)i+1;
SCLineArray.Product_ID = ((j*10000)+j).ToString();
SCLineArray.Product_Name = "Test Item " + j.ToString();
SCLineArray.Quantity = j.ToString();
SCLineArray.Unit_Price = (decimal)(j * 125);
SCLineArray.Extended_Price = j * SCLineArray.Unit_Price;
}
// Insert Shopping Cart Header
serviceHeader.Create(ref SCHeader);
for (int i = 0; i < SCLineArray.Length; i++)
{
serviceLine.Create(ref SCLineArray);
SCLineArray.Product_Name += "Again";
serviceLine.Update(ref SCLineArray);
}
Thanks in advance.
0
Comments
Tim
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.