Command Parameters

  • Thread starter Thread starter Alberto
  • Start date Start date
A

Alberto

In a stored procedure of sql server I've got an output parameter called
@Return of type int.

After execute the stored procedure I'm trying to read the output value
with Convert.ToInt32(command.Parameters["@Return"].SqlValue) but VS says
that can't convert it into a System.IConvertible type.

SqlValue is of type object and I can see in the debuger that it has the
right value (an int number) so I don't understand why it doesn't work.

Thank you.
 
In a stored procedure of sql server I've got an output parameter called
@Return of type int.

After execute the stored procedure I'm trying to read the output value
with Convert.ToInt32(command.Parameters["@Return"].SqlValue) but VS says
that can't convert it into a System.IConvertible type.

SqlValue is of type object and I can see in the debuger that it has the
right value (an int number) so I don't understand why it doesn't work.

Can we get:
- complete statement
- complete error text
- the value of command.Parameters["@Return"].SqlValue.GetType().FullName
?

Arne
 
In a stored procedure of sql server I've got an output parameter called
@Return of type int.

After execute the stored procedure I'm trying to read the output value
with Convert.ToInt32(command.Parameters["@Return"].SqlValue) but VS says
that can't convert it into a System.IConvertible type.

SqlValue is of type object and I can see in the debuger that it has the
right value (an int number) so I don't understand why it doesn't work.

Can we get:
- complete statement
- complete error text
- the value of command.Parameters["@Return"].SqlValue.GetType().FullName
?

Arne

Maybe you could do
Int32.Parse(command.Parameters["@Return"].SqlValue.ToString()

Or Int32.TryParse.
 
Back
Top