I am struggling a little bit with getting a decimal datatype back from my stored procedure.
In my table, I have columns whose datatype is decimal 9 (18,4). I have a stored procedure that gets a row from that table, and I have a parameter for the decimal column defined as:
@mid AS decimal(18,4) OUTPUT
Is that correct? First I had it as decimal(9) but I wasn't sure I was getting it back correctly.
Then in my vb code, is this correct?
In the debugger, if I look at p12.Value it says 10D. The value is something more like 10.1356. Am I doing something wrong or is it the debugger's way of displaying it and how do I get the precision I want?Code:Dim p12 As New SqlParameter() p12.ParameterName = "@mid" p12.SqlDbType = SqlDbType.Decimal p12.Direction = ParameterDirection.Output command.Parameters.Add(p12) conn.Open() command.ExecuteNonQuery() mid = CDec(p12.Value)
Thanks.




Reply With Quote