Dmitri,
The Value property is of type object. However, that doesn't mean that
it is an object that is stored. Since every type derives from object, it is
the only type the property can expose which will cover every possible value
returned.
In order to access your property, cast the result of the Value property
to int and then you should be able to access it normally.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"Dmitri Khanine" <kh*****@hotmail.com> wrote in message
news:d4**************************@posting.google.c om...
Hi All
Trying to retrieve the value of the Sqlcommand' parameter as integer.
Here is how I declare it:
SqlParameter paramId = command.Parameters.Add("@id", SqlDbType.Int);
paramId.Direction = ParameterDirection.InputOutput;
paramId.Value = id;
.....
The only method of the SqlParameter available is ToString() so I have
to retrieve it in the following ugly way:
id = Int64.Parse( "0" + paramId.Value.ToString() );
Anyone knows of a prettier way to do it?
Thanks very much!!!