SqlCommand Parameters Problem

  • Thread starter Thread starter Jorge
  • Start date Start date
J

Jorge

Hello

I have a store procedure that has 2 parameters declared
datatype Numeric as per the SQL table.

When i try to use the following:

Me.SqlCommand1.CommandType = CommandType.StoredProcedure
Me.SqlCommand1.Parameters.Clear()
Me.SqlCommand1.CommandText = "altera_linha_encomenda"

With Me.SqlCommand1.Parameters
<snip>
.Add("@punit", SqlDbType.Decimal).Value = punit
.Add("@prazo", SqlDbType.Decimal).Value = prazo
End With
Try
Me.SqlCommand1.ExecuteNonQuery()
Catch
MessageBox.Show(Err.Description)
End Try

I get an execption : Error converting data type numeric
to numeric.

I tried Money,float, etc. none work, my problem there's
no SqlDbType.Numeric to use !?

Any suggestions would be most welcome.

Kind Regards
Jorge Cavalheiro
 
a little addenda

I tried to use DeriveParameters on the stored procedure
and punit is declared as numeric(9,2) was converted to
decimal with scale 9 , precision 2 and size 0.

I tried the following :
..Add("@punit", SqlDbType.Decimal, 0).Value = punit
..Add("@punit", SqlDbType.Decimal, 9).Value = punit
..Add("@punit", SqlDbType.Decimal, 2).Value = punit
..Add("@punit", SqlDbType.Decimal, 11).Value = punit

And still the same exception : Error converting data type
numeric to numeric.

I am running out of ideas i DON'T want to use exec stored
params

Kind Regards
Jorge
 
Back
Top