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.
Queennie LAsked:
Who is Participating?
 
Paul MacDonaldConnect With a Mentor Director, Information SystemsCommented:
Yeah, sorry:

lsTotalPrice = CStr(System.Math.Round(lnTotalPrice, 2))
0
 
Paul MacDonaldDirector, Information SystemsCommented:
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)))
0
 
Queennie LAuthor Commented:
There is an error when I remove the ABS.

It says "Identifier expected".

Thank you.
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Queennie LAuthor Commented:
It's still not working.
0
 
Paul MacDonaldDirector, Information SystemsCommented:
In what way is it not working?  The "Identifier expected" problem should be resolved...
0
 
David Johnson, CD, MVPOwnerCommented:
Try this
lsTotalPrice=CStr( (System.Math.Round(lnTotalPrice, 2)))
0
 
Queennie LAuthor Commented:
@Paulmacd:

You are right. It was my end.

Thank you for your help.
0
 
Paul MacDonaldDirector, Information SystemsCommented:
Happy to help.  Thanks for the points!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.