Page 1 of 1

how to programatically increment the ordernumber

Posted: Mon Jan 16, 2012 1:21 pm
by harryhair5
I'm inserting orders programatically from another system. When I set the order number:

Code: Select all

            Order curOrder = new Order();
            Store curStore = StoreDataSource.Load(1);
            curOrder.OrderNumber = curStore.NextOrderId;
            ...
            curOrder.Save();
It doesn't increment for the next order I insert. How can I increment it? I've tried:

Code: Select all

            curStore.NextOrderId += 1;
            curStore.Save();
            curStore.OrderIdIncrement;
and

Code: Select all

curOrder.OrderNumber = StoreDataSource.GetNextOrderNumber();
But still each time, the ordernumber is the same.

Re: how to programatically increment the ordernumber

Posted: Mon Jan 16, 2012 3:50 pm
by david-ebt
Do you have the

Code: Select all

Order curOrder = new Order();
code inside your order-creation loop? Or are you reusing the curOrder object?