Re: Conversion problem SqlDBType.Decimal -> T-SqlType Decimal (12,6)
P_at_rick
Date: 05/28/04
- Next message: Alisson Vale: "Re: Intermittent IndexOutOfRangeException - SqlDataReader"
- Previous message: Cowboy: "Re: Need DataGrid Help"
- In reply to: Frans Bouma [C# MVP]: "Re: Conversion problem SqlDBType.Decimal -> T-SqlType Decimal (12,6)"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 28 May 2004 15:05:00 +0200
thanxx, it works!
Regards,
P@rick
"Frans Bouma [C# MVP]" <perseus.usenetNOSPAM@xs4all.nl> wrote in message
news:xn0dis2zm4xtpd000@msnews.microsoft.com...
> P@rick wrote:
> > I want to call a stored procedure containing a decimal parameter:
> >
> > SqlCommand dbCommand = new SqlCommand("myStoredProcedure",
myConnection);
> > dbCommand.CommandType = CommandType.StoredProcedure;
> > SqlParameter parmTOHighShort = dbCommand.Parameters.Add("@dTOHighShort",
> > SqlDbType.Decimal, 9);
>
> You didn't set the precision, you set the size to 9, but the precision is
> 12, and the scale is 9. so yo have to add:
> paramTOHighShort.Precision = 12;
> paramTOHighShort.Scale = 9;
>
> FB
>
>
>
>
> > parmTOHighShort.Direction = ParameterDirection.Input;
> > parmTOHighShort.Value = dataObject.TOHighShort;
> > try
> > {
> > dbCommand.ExecuteNonQuery();
> > }
> > catch (Exception e)
> > {
> > int i = 0;
> > }
> >
> > in the stored procedure this parameter is specified as follows:
> >
> > CREATE PROCEDURE dbo.[myStoredProcedure]( @dTOHighShort AS DECIMAL
(12,9) )
> >
> > AS
> >
> > ....
> >
> > this does not work because the SqlDBType.Decimal do not specify any
> > precision, but the T-Sql data type does!
> >
> > Do any one know how to solve this problem ?
> >
> > Regards,
> > P@rick
>
>
> --
> Get LLBLGen Pro, the new O/R mapper for .NET: http://www.llblgen.com
> My .NET Blog: http://weblogs.asp.net/fbouma
> Microsoft C# MVP
- Next message: Alisson Vale: "Re: Intermittent IndexOutOfRangeException - SqlDataReader"
- Previous message: Cowboy: "Re: Need DataGrid Help"
- In reply to: Frans Bouma [C# MVP]: "Re: Conversion problem SqlDBType.Decimal -> T-SqlType Decimal (12,6)"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|