Hello -
I've got a Microsoft SQL Server 2005 Database running with ASP.NET 1.1/VB .NET interface, I'm having an issue with my parameters.
I am using a sp to retrieve values, then doing math in vb .net, then using a sp to input the modified values back.
I am aware of a bug with decimals if nulls are passed in SQL 2000 - that's not the case here. Anyway, here's some code:
Dim NM As New Decimal
Dim
pNM As New SqlParameter("@ANBP_NM", SqlDbType.Decimal, 18, 2)
pNM.Direction = ParameterDirection.Output
oCM.Parameters.Add(pNM)
oCM.CommandText = "ANBP"
oCM.CommandType = CommandType.StoredProcedure
oCM.Connection = objCN
oCM.Connection.Open()
oCM.ExecuteNonQuery()
oCM.Connection.Close()
NM = pNM.Value
Dim
b As New Decimal
b = NM
b += 0.01
My connection string and all that are correct - I use the same for everything and everything works fine - including the sending of the processed data (b += 0.01) - because in my database, the value is showing as "NM".01 - the problem is, it's rounding NM to the nearest whole number, up or down, and completely negating the decimal - then ADDING .01 as the decimal. It's replacing the decimal. I've tried this with =, +=, subtraction variants (they're possible, I've just abandoned them as they're the long way), my sp's are all declared properly with decimal(18,2) OUTPUT (where appropriate), I've even thrown in some Math. functions - no luck.
Any ideas???