.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

cast and convert issues? really puzzled!

Posted By:      Posted Date: September 10, 2010    Points: 0   Category :Sql Server
Hi all,   I have an issue with cast, when i am converting nvarchar which is a number to float or money, i get the result multiplied by 100 in some cases and in some cases it is fine. Ex: select cast ( [qty] as float), cast([price] as money) qty and price are both nvarchar(50) if qty - 10.00 price 200.00 (before conversion),  its qty - 1000 and price is 20000 (after conversion)   Please let me know if there is any issue using cast.   Thanks in advance.

View Complete Post

More Related Resource Links

Cast Convert Question


What is the "best practice" for converting from one custom reference type to another? I typically handle this in home grown "Converter" classes and was just looking for a more patterened approach.

Chris Wigley MCAD\MCPD

Convert/Cast Single to double inaccurate.


Whilst I have read some background on floating opint numbers not being able to accurately store numbers such as 0.1, I am not clear why converting from single to double is so inaccurate.

Converting a single 0.1 to a double 0.1 yeilds


But 0.1 can be represented in a double more accurately, even if not perfectly as


This stems from the single representation of 0.1 actually equating to 0.10000000149011600 in binary.

However, we know that the single has a particular level of precision.

I would like a conersion function that converts single 0.10000000 to double 0.1000000000000000.

I can appreciate that the standard conversion functions would need to still exist as real numbers for engineering would suffer less overall inaccuracies with the existing rounding functions.


One other question:

Can the convertsion be affected by the OS/framework/hardware or will it be consistent on different machines?  Are there any settings that can change the conversion behaviour?



Convert English to Arabic number without changing any regional settings in .net

Well, most applications that I worked with was multilingual that supports English UI and Arabic UI.

And one of the major issue that we have faced is displaying Arabic numbers without the need of changing the regional settings of the PC.

So the code below will help you to display Arabic number without changing any regional settings.

is it possible to convert whole visual studio 2008 web site project to visual studio 2010 web site p


is it possible to convert whole visual studio 2008 web site project to visual studio 2010 web site project


my current project references




i have a very annoying iis problem

iis server stops working until app pool is recycled


i am hoping that new visual studio (net framework 4.0) may solve this very annoying unsolveable problem


How to cast integer values as an array of enum values?


Hello all!

I'm working with VS2010 Beta2, ASP.NET and Dynamic Data. I'm using VB but will certainly be happy to receive a C# example if necessary. Laughing

I used a few of Steve's examples (Writing Attributes and Extension Methods for Dynamic Data and Dynamic Data - Hiding Columns in selected PageTemplates) to create a custom property attribute to be applied to a dynamic data column and want it to accept an array of enum values (each value will represent a dynamic data page template where this column should not be displayed).  My new attribute works fine when I hardcode it like this, meaning the HideColumnIn attribute is properly populated with the array of enum values:

<HideColumnIn(PageTemplate.List, PageTemplate.Edit)> _
Public Property My_DD_Column As Object


However, I want to store the values to be used for the HideColumnIn in the DB as integer values that correspond to the

Convert excel file into xml


Hai, I have two columns with id,name in the excel sheet.I want to convert into xml file in the below format

<?xml version="1.0" encoding="utf-8"?>

<guide xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Boat id="1"> <name> Copper Kettle </name> </Boat> <Boat id="2"> <name> Copper Penny </name> </Boat> <Boat id="3"> <name> Copperhead </name> </Boat> <Boat id="4"> <name> Coppertone </name> </Boat> <Boat id="5"> <name> Copy Boy </name> </Boat> </guide>

suggest me with sample code in ASP.NET. Thanks


convert SQL data to EDI 835 file


I was assigned to create a app to convert SQL data to EDI 835 file. (Electronic Data Interchange file for Health Care Claim Payment/Advice,  outbound process only).

Can someone help me where to start?

IE 8 Issues with Chinese/Japanese Characters


On my web application, I display information in different languages. Everything works fine in IE compatibility mode and FireFox but it shows boxes for chinese/japanese languages. I am pretty much having the same issue as described here



Thanks for your help.

Convert WCF service to self hosting application


 I created project as a  WCF Service application and now according to recuriment that needs to be converted as a self hosting application

How can i do this?

Converting WCF service app to Self hosting app?

How to Convert HTML to Image


 HI all,

I was struggling for the process/code to convert html to image. Please suggest any tutorials for this. And also any code help greatly appreciated.


thanks and regards,



convert jpeg to tiff


Hi all,

I need to comvert jpeg to tiff using c#.net

I have achieved this but problem is image size is increasing drastically. eg: 25 kb of jpeg image is converted to 650 kb of tiff image.

What should be done to have the same image size as of original or atleast double the image size as of original.

Please suggest me. Thanks in advance.

Crystal Report vs 2003 convert to vs 2008 parameter problem


Hi friend,

I have a project develop with Visual Studio 2003, when i convert the project to Visual Studio 2005 is work well. But when i convert to Visual Studio 2008, the crystal report when have pass parameter will prompt the parameter field to re-type then show the report.

But in this converted project i create a new report and pass the parameter is ok. That means i wan re-do all report @.@??

Does someone can help me solve this problem??

Thank you

Convert Cold Fusion to VB.Net


Could someone please help me convert the following code to VB.Net?  

<cfif isdefined("form. backgroundCheckResult")> 


                <cfif processingStatus eq "success">

                                <cfoutput>success </cfoutput>





Cannot convert type 'object[]' to 'byte[]'


I am doing this .. and i want to convert object array to byte array. How should I do that?

Object[] myVal = um.myData;

Byte[] byteArray = (Byte[])myVal;

Want to convert the code from c# to asp

  1.  WebRequest myWebRequest = WebRequest.Create(URL);  
  2.                 WebResponse myWebResponse = myWebRequest.GetResponse();  
  3.                 Stream ReceiveStream = myWebResponse.GetResponseStream();  
  4.                 Encoding encode = System.Text.Encoding.GetEncoding("utf-8");  
  5.                 StreamReader readStream = new StreamReader(ReceiveStream, encode);  
  6.                 string strResponse = readStream.ReadToEnd();  
  7.                 Response.Write("Response from site"

Concurrency: Tools And Techniques to Identify Concurrency Issues


Efficient parallel applications aren't born by merely running an old app on a parallel processor machine. Tuning needs to be done if you're to gain maximum benefit.

Rahul V. Patil and Boby George

MSDN Magazine June 2008

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