.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

round function in vb.net related to system.math

Posted By:      Posted Date: September 12, 2010    Points: 0   Category :.NET Framework
when i finding the value to round some decimal or double number below problem i faced system.math.round(12.50)        ans: 12 system.math.round(12.51)        ans: 13 the same problem also in floor function .........these problems in framework 3.5 and framework 4.0 also

View Complete Post

More Related Resource Links

SQL Round function dosen't act like Math.Round in VB.Net


I'm trying to calculate a customer tax.

Select 100 * Round(25296 /100 ,1) --returns 25200

 however Math.Round in Visual Basic, return 25300.

 Result = 100 * Math.Round(25296 / 100) ' returns 25300

I really nead any appropriate function to fix it.

Plese help soon.

Query Plan handle is not matching in the query related system DMV's


Ent : SQL Server 2008 SP17

OS  : Windows Server 2008 Ent.Edt

While troubleshooting a performance issue for a Query (SP) I came across this weired thing that the Query Plan handle is not matching across all the Query related system DMV’s.


Senario with a simple query

For each executing Query a plan handle is generated in sys.dm_exec_connections (Column most_recent_sql_handle).Based on the sql_handle the q

Please advise on ROUND function


Not my original db, data or procedure as I have been tasked with developing an updated infosys (to a .NET app and SQLServer db).  Anyway, the original app/db has a rounding specification that is a bit strange to me and need some input on how I should proceed.  The original system architects decided they'd perform a round down on a particular field (int) which is ultimately used in a fee calculation.

Not a big deal because I could just issue a ROUND(theField, -2) --- But I found a problem.  At first glance it seemed that they wanted to round to the 10th:

3143 would round to 3100 with ROUND(3143, -2)

But if I come across a value such as 4075 this would then round to 4100 with ROUND(4075, -2)  WHEN THEY WANT THIS TO BE 4000.  That is, to arrive at 4000, then I'd need to issue a different ROUND(4075, -3)

Does this make sense? 

How should I approach this? 

 Is this a proceedure/logic probelm or am I looking at this with too limited vision in what needs to be done (SQL-wise)?


Thanks for your input,




James Crandall ~ http://javitechnologies.com Spatial Database Solutions

Whether Date & Math function supported in WCF Data service



Whether Data(day,year,hour,minute,month,second) and Math functions(double round, decimal round, double floor, decimal floor, double ceiling, decimal ceiling) are supported in WCF data service using ODATA.

Thank You Benita Blas

Error "Could not find server 'System' in sys.servers" with non-context connection in CLR function


When trying to open a non-context connection in a CLR scalar valued function I am receiving the Exception:

Could not find server 'System' in sys.servers. Verify that the correct server name was specified. If necessary, execute the stored procedure sp_addlinkedserver to add the server to sys.servers

I encounter this problem on two different SQL Server 2005 servers. The error seems strange to me since I am not using linked servers.

Here is an extract from my function:



class LimitSystemFunctions
  public static<

Strange behaviour from System.IO.DirectoryInfo. Exists function


I am developing an application using c# and asp. It need to access some places in the local network . There is a text box in the form which accept the path to be accessed from the user and will store it to a string variable named location.

The if loop always return false if the application run in windows 7. and it occurs only when I run from the installed application, otherwise it will return true if the path is true. Here is the code:

CLR-based Function using System.Drawing throwing 6522 after update of server to 2008 SP2


I wrote a DLL that uses system.drawing to shrink/resize images stored in SQL field.  Worked yesterday.  Today, all references to that dll (via SQL function field) blow up with this error. 


Msg 6522, Level 16, State 1, Line 2

A .NET Framework error occurred during execution of user-defined routine or aggregate "ImageScaler":

System.IO.FileLoadException: Could not load file or assembly 'System.Drawing, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Assembly in host store has a different signature than assembly in GAC. (Exception from HRESULT: 0x80131050) See Microsoft Knowledge Base article 949080 for more information.


at UserDefinedFunctions.ImageScaler(SqlBytes inImageBytes, Double ImgHeight, Double ImgWidth)


I believe this KB article explains the situation:


Round off time to the nearest minute

How would you round this up to the nearest minute? There isn't a built in function to do this so you have to use a little bit of maths to get there. There are 60 seconds in a minute. We already have 38 seconds on the clock. So we need to add on 60 - 38 = 22 more seconds.

System Development Life Cycle

The Systems Development Life Cycle (SDLC) is a conceptual model used in project management that describes the stages involved in an information system development project from an initial feasibility study through maintenance of the completed application. Various SDLC methodologies have been developed to guide the processes involved including the waterfall model (the original SDLC method), rapid application development (RAD), joint application development (JAD), the fountain model and the spiral model. Mostly, several models are combined into some sort of hybrid methodology

The Agile System Development Life Cycle (SDLC)

The goal of this article is to describe the agile system development life cycle (SDLC), putting it in context from what you may have heard about within the agile community and more importantly within the context of your overall IT efforts.

Display Related Data in an ASP.NET GridView

Typically when you display a datagrid you will want to show data from a related table. There are 3 different ways to accomplish this with NetTiers. You can use a custom stored procedure, deepload functionality from the code behind, or a strongly typed datasource control. We'll provide an example of each

Performance Tests: Precise Run Time Measurements with System.Diagnostics.Stopwatch

Everybody who does performance optimization stumbles sooner or later over the Stopwatch class in the System.Diagnostics namespace. And everybody has noticed that the measurements of the same function on the same computer can differ 25% -30% in run time. This article shows how single threaded test programs must be designed to get an accuracy of 0.1% - 0.2% out of the Stopwatch class. With this accuracy, algorithms can be tested and compared.



hello i have the following problem

i have upload my content to hosting server but i get the following error

Security Exception

Description: The application attempted to perform an operation not allowed by the security policy.  To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[SecurityException: Request for the permission of typ

Problem upgrading to MVC3 - System.Web.Routing



I'm trying to upgrade to .NET 4 and MVC 3.

When trying to compile my project, I get the error:

Error 1 The type or namespace name 'Routing' does not exist in the namespace 'System.Web' (are you missing an assembly reference?) C:\Users\spencer\Desktop\weblauncher\Common\MVCConfig.cs 4 18 Common

The type or namespace name 'Routing' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)

I do have the System.Web.Routing in my references for the project.

BUT - when I try to view System.Web.Routing in the OBJECT BROWSER, nothing is inside!  The System.Web.Routing namespace is not in there - the entire thing is empty!  Could it that the dll is corrupted?  I tried to reinstall the .NET 4 and MVC 3 stuff, but its still empty!

The dll is coming from here:

C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Web.Routing.dll

and the runti

Content page control passes as argument to javascript function


Here is the content page:


<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="JavaDynamicCopyValue.aspx.cs" Inherits="JavaDynamicCopyValue" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
 <script type="text/javascript" >
 function copyValue(input, output )
   ouput.value = input.value;
   return true;
 <asp:TextBox ID="txt1" runat="server" onchange="copyValue(this,document.getElementById('<%=txt2.ClientID%>'))"></asp:TextBox>
    <br />
    <br />
    <asp:TextBox ID="txt2" runat="server"></asp:TextBox>


I got a javascript run time error says output is undefined. if I view source of the page, the txt1 markup became:

<input name="ctl00$ContentPlaceHol

System.Security.SecurityException: Request for the permission of type 'System.Web.AspNetHostingPerm


Good Day all,

Having an issue with an outside user accessing my IIS7 box. I do not have this problem when running the website from my host machine. I found this post: Http://forums.asp.net/t/1371394.aspx. I assure you that this is not a solution because I am not storing any of my files on a network share. 

What do you think my approach should be. 

I already have read rights to IIS user to my BIN folder. 

Thanks for the help. 

System.IO.Packaging is not visible


I am new to ASP.net, I installed VS2005 and IIS 5 on my PC and set up my first website using IIS (not the embedded webserver in VS).

For some reason I cannot find the Assembly: "System.IO.Packaging", please let me know if I am allowed to use it in that medium and how can I reference it?

Thanks in advance.

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend