顯示具有 ASP 標籤的文章。 顯示所有文章
顯示具有 ASP 標籤的文章。 顯示所有文章

2016年11月15日 星期二

Round & FormatNumber 四捨五入的區別

資料來源:Round & FormatNumber 四捨五入的區別


VBScript Round() 為四捨五入函數,但是 Round() 四捨五入為近偶取整,與我們平常用的並不一樣,平時是以大於等於 5 的數值進位、小於 5 的數值捨去。FormatNumber() 的值比較符合平常用的值。使用 Round() 近偶取整則於偶數才進位與 FormatNumber() 四捨五入有差異由下表來分析差異點。

利用Server.mapPath()取得網站相關路徑

資料來源:
利用Server.mapPath()取得網站相關路徑(HttpContext.Current.Server.MapPath,路徑,根目錄,目前應用程式,上一層,類別,vb,HttpContext.Current.Server.MapPath))




'假設目前程式路徑:c:\Inetpub\wwwroot\myApp\subDir\subDir2\abc.aspx '取得目前應用程式路徑,ex:c:\Inetpub\wwwroot\myApp\ Dim aaa As String = Server.MapPath("~\") '取得目前應用程式路徑,ex:c:\Inetpub\wwwroot\myApp\ Dim bbb As String = Server.MapPath("~/") '取得目前應用程式路徑,ex:c:\Inetpub\wwwroot\myApp\ Dim fff As String = Server.MapPath("~") '取得根目錄路徑,ex:c:\Inetpub\wwwroot\ Dim ccc As String = Server.MapPath("/") '取得目前頁面路徑,ex:c:\Inetpub\wwwroot\myApp\subDir\subDir2\ Dim ddd As String = Server.MapPath("./") '取得目前頁面上一層路徑,ex:c:\Inetpub\wwwroot\myApp\subDir\ Dim eee As String = Server.MapPath("../") '取得目前頁面上上一層路徑,ex:c:\Inetpub\wwwroot\myApp\ Dim hhh As String = Server.MapPath("../../")