Showing results for 
Search instead for 
Did you mean: 

passing double values via c#

Former Member
0 Kudos

I am trying to make a purchaseorder via the sdk with

Everything works fine but when i try to pass a quantity or a price as a double (eg 2.34) i lose the digits behind the comma.(i tried the same in, there it works but i'd prefer c#.)

Here is the code:

SAPbobsCOM.Documents oOrder = (SAPbobsCOM.Documents)oCompany.GetBusinessObject SAPbobsCOM.BoObjectTypes.oPurchaseOrders);
oOrder.DocObjectCode = SAPCOM.BoObjectTypes.oPurchaseOrders;
oOrder.HandWritten = SAPbobsCOM.BoYesNoEnum.tNO;
oOrder.DocDate = System.DateTime.Now;
oOrder.DocDueDate = System.DateTime.Now;
oOrder.CardCode = "30005";
oOrder.Lines.ItemCode = "581330g";
oOrder.Lines.ItemDescription = "abcd";
oOrder.Lines.Quantity = 1.5
oOrder.Lines.Price = 2.34;

int iRetCode = oOrder.Add();

if (iRetCode != 0)
    //... errors
    //... wrote order to database

thanks for any help

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi franz,

Which separator have you got defined in the general settings?

If it is "," SBO will not understand your number as a double.

You could try to pass the values as strings with "," separator instead of an double. I suppose SBO will parse it.


Ibai Peñ

Former Member
0 Kudos

Thank you for your help.

The problem was more global.

When opening a connection to a btrieve database via odbc i lost the digits behind the comma.

I solved it with a new extern process.