使用 VB.NET 将负整数转换为正整数

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20182568/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-17 15:57:06  来源:igfitidea点击:

Convert negative integer to positive using VB.NET

sql-servervb.netinteger

提问by Dan

How to convert negative integer to positive integer using vb.net ? Also if there is a function in SQL Server 2008 to do the same concept ?

如何使用 vb.net 将负整数转换为正整数?另外如果在 SQL Server 2008 中有一个函数来做同样的概念?

回答by Mitch Wheat

In .NET, use Math.Abs()

在 .NET 中,使用 Math.Abs()

In TSQL, use ABS()

在 TSQL 中,使用 ABS()

回答by Rose

Regardless of the language you're programming in. You can multiply any number by -1 to change the number's sign.

无论您使用哪种语言编程。您可以将任何数字乘以 -1 来更改数字的符号。

-5 * -1 = 5
5 * -1 = -5

回答by Andrey

Abs()in SQL Serverand Math.Abs()in VB.NET

Abs()SQL服务器Math.Abs()VB.NET