"Failed to convert parameter value from a String to a Decimal."

Below is the Procedure, code calling procedure and the last line is the varable passed

(@ProductId INT,
@ProductSize VARCHAR(25),
@Price MONEY,
@SalePrice MONEY)
INSERT INTO PriceTable(ProductId,ProductSize, Price, SalePrice)
VALUES(@ProductId, @ProductSize, @Price, @SalePrice)

Open in new window

 public static bool AddPrice(string ProductId, string ProductSize, decimal Price, decimal SalePrice)
        DbCommand comm = genericDataAccess.CreateCommand();
        comm.CommandText = "AddPrice";

        DbParameter param = comm.CreateParameter();
        param.ParameterName = "@ProductId";
        param.Value = ProductId;
        param.DbType = DbType.Int32;

        param = comm.CreateParameter();
        param.ParameterName = "@ProductSize";
        param.Value = ProductSize;
        param.DbType = DbType.String;

        param = comm.CreateParameter();
        param.ParameterName = "@Price";
        param.Value = "Price";
        param.DbType = DbType.Decimal;

        param = comm.CreateParameter();
        param.ParameterName = "@SalePrice";
        param.Value = SalePrice;
        param.DbType = DbType.Decimal;

        // result will represent the number of changed rows
        int result = -1;

            // execute the stored procedure
            result = genericDataAccess.ExecuteNonQuery(comm);
            // any errors are loggin in genericdata access we ignore them here

        return (result != -1);

bool success = CatalogAccessClass1.AddPrice(ProductId.Text, ProductSize.Text, Convert.ToDecimal(Price.Text) , Convert.ToDecimal(SalePrice.Text));

Open in new window

Ron RenningerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Shaun KlineLead Software EngineerCommented:
This is wrong:
 param.Value = "Price";

It should be:
 param.Value = Price;

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ron RenningerAuthor Commented:
Thank you it was hard to find after looking at the code for a long time
Ron RenningerAuthor Commented:
It is asp.net using C# but i did not see it in the drop down list
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.