Link to home
Start Free TrialLog in
Avatar of Queennie L
Queennie L

asked on

Convert negative output in 2010 VB.net

I am trying to import using 2010 VB.net and SQL 2008 R2 to text file but for a negative numbers it defaults to positive as an output when imported.

I have been trying to search but no luck.

2010 VB.net:


 lsTotalPrice = CStr(System.Math.Abs((System.Math.Round(lnTotalPrice, 2)))) 

Open in new window


Example:
SQL Table column is

Total Price:
-105.10(Negative)

Text file:
It displays as output is
105.10(Positive)


Any help is much appreciated.

Thank you.
Avatar of Paul MacDonald
Paul MacDonald
Flag of United States of America image

The ABS command will change it from negative to positive.  Remove the ABS and you should be okay.

lsTotalPrice = CStr(System.Math.(System.Math.Round(lnTotalPrice, 2)))
Avatar of Queennie L
Queennie L

ASKER

There is an error when I remove the ABS.

It says "Identifier expected".

Thank you.
ASKER CERTIFIED SOLUTION
Avatar of Paul MacDonald
Paul MacDonald
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
It's still not working.
In what way is it not working?  The "Identifier expected" problem should be resolved...
Try this
lsTotalPrice=CStr( (System.Math.Round(lnTotalPrice, 2)))
@Paulmacd:

You are right. It was my end.

Thank you for your help.
Happy to help.  Thanks for the points!