|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Urgent!...SQL Server cannot handle "CDEC" in web applicationI have created a web application, in visual studio 2005 professional. This application needs to convert some string values, from an externally stored SQL database table, to decimals. When the application has been compiled and is running locally in the computer everything works fine, all calculations in the application end up correctly. The problem comes when the application is running at the web server (an extern SQL Server), then all calculations goes wrong, badly wrong!!! 0,46 * 0,56 ---> 0 123,456 ---> 123456 and so on... Why?? ------------------------ Example, calculation from code: tSum = Round(totSum + (NullSafeDecimal(reader.Item("column1")) * NullSafeDecimal(reader.Item("column2"))), 2) '**************************************************** ' NullSafeDecimal '**************************************************** Public Shared Function NullSafeDecimal(ByVal arg As Object, _ Optional ByVal returnIfEmpty As Integer = 0) As Decimal Dim returnValue As Decimal If (arg Is DBNull.Value) OrElse (arg Is Nothing) _ OrElse (arg Is String.Empty) Then returnValue = False Else Try returnValue = CDec(arg) Catch returnValue = False End Try End If Return returnValue End Function In article <A09265B7-AC56-4ECB-A0A9-FB22783E3***@microsoft.com>,
Y**@discussions.microsoft.com says... > I have created a web application, in visual studio 2005 professional. This Are the regional settings for both machines exactly the same?> application needs to convert some string values, from an externally stored > SQL database table, to decimals. When the application has been compiled and > is running locally in the computer everything works fine, all calculations in > the application end up correctly. > > The problem comes when the application is running at the web server (an > extern SQL Server), then all calculations goes wrong, badly wrong!!! > > 0,46 * 0,56 ---> 0 > 123,456 ---> 123456 > > and so on... Why?? |
|||||||||||||||||||||||