Negative money inserted as $-2.-0543

Posts   
 
    
Posts: 2
Joined: 04-Dec-2016
# Posted on: 04-Dec-2016 02:35:51   

And that fails in SQL server.... Using LLBLGen Pro 2.6 and SQL Server 2008R2

Somehow LLBLGEN generates an insert query with negative money variables like this, with an extra minus/hyphen:

@PriceEx=$-2.-5350

When I manually remove the second hyphen to $-2.5350, the query works..

I am not familiar with LLBLGEN, I inherited the project of a former colleague but running into this issue right now... So here are the questions:

1 is there a setting to force LLBLGen to write decimals in stead of money without the $ sign and weird extra hyphen/minus sign? 2 Is there a setting in SQL Server to accept $-2.-5350 as a valid money value? 3 Is there a way to 'catch and alter' the statement right before it is send to SQL Server so I can manually delete the second '-' / hyphen / minus sign? 4 Is there a way to 'replace / alter' the money conversion routine of LLBLGen?

Hope somebody knows where this comes from... Thanx in advance for your help!

Regards, Marc

The complete insert statement:

declare @p3 int set @p3=51 exec sp_executesql N'INSERT INTO [evHorstb2c].[dbo].[OrderItem] ([OrderId], [ProductId], [SubcodeId], [ProductName], [SubcodeNumber], [SubcodeName], [ProductSubcodeName], [QuantityStandard], [QuantityExtra], [PriceEx], [BtwId], [BtwCode], [ManualOrder], [Created], [CreatedBy]) VALUES (@OrderId, @ProductId, @SubcodeId, @ProductName, @SubcodeNumber, @SubcodeName, @ProductSubcodeName, @QuantityStandard, @QuantityExtra, @PriceEx, @BtwId, @BtwCode, @ManualOrder, @Created, @CreatedBy);SELECT @OrderItemId=SCOPE_IDENTITY()', N'@OrderItemId int output,@OrderId int,@ProductId int,@SubcodeId int,@ProductName varchar(100), @SubcodeNumber varchar(20),@SubcodeName varchar(100),@ProductSubcodeName varchar(200),@QuantityStandard float, @QuantityExtra float,@PriceEx money,@BtwId int,@BtwCode int,@ManualOrder bit,@Created datetime,@CreatedBy int', @OrderItemId=@p3 output,@OrderId=31,@ProductId=279,@SubcodeId=1,@ProductName='Korting: 25.00% over 10.75 incl. BTW', @SubcodeNumber='000',@SubcodeName='',@ProductSubcodeName='Korting-Btw-6',@QuantityStandard=0,@QuantityExtra=1, @PriceEx=$-2.-5350,@BtwId=NULL,@BtwCode=1,@ManualOrder=1,@Created='2016-12-04 01:21:46.880',@CreatedBy=15 select @p3

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 05-Dec-2016 07:25:26   

Hi Marc,

To help you better, please answer these questions:

What is the LLBLGen Runtime library version (RTL) that you are using.? Ref: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=7717

What is the .net framework version that you project targets?

What is your .net code that actually generates this SQL?

Is your generated code customized in some form?

Does this happen always or sometimes (how)?

When this started to happen?

David Elizondo | LLBLGen Support Team
Posts: 2
Joined: 04-Dec-2016
# Posted on: 12-Dec-2016 04:22:17   

Hay David,

As said it is a very old version of LLBLGen we inherited a long time ago...

1 LLBLGen - 09-03-2009 2 .Net 3.5 3 Standard LLBLGen code 4 No modifications, just by LLBLGen generated code 5 We never noticed this before. We never have written negative values in this piece of software (strange !) since every negative money value fails, also in other tables when testing. 6 I do not know, we just implemented some extra functionality and noticed this

We changed all money fields to Decimal 19,4 and everything worked eventually.

No need for you to dig into this, you probably fixed this in a more recent version. You can close this threat!

Thanx for reacting, regards, Marc