Urgent!...SQL Server cannot handle "CDEC" in web application

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Please, can sombody help me with this problem.

I 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
 
I 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??

Are the regional settings for both machines exactly the same?
 
Back
Top