ExecQuery error that I can't find, need an expert :)

Claude Larocque 666 Reputation points

When I choose a product on my combo box on my FrmBilling form, my ExecQuery should send data to my OrderLines SQL table, however, I received an error that I show all the details in the PDF document attach.

Can you help me figure out that error?

Thanks you, Claude from Quebec, Canada

ExecQuery error.pdf


SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,263 questions
0 comments No comments
{count} votes

Accepted answer
  1. Erland Sommarskog 106K Reputation points MVP

    I don't know what that SQL.AddParam("@TaxRate3", Me.TaxRate3TB.Text and SQL.ExecQuery etc are. Some kind of homebrew?

    In any case, I get the impression that it passes the parameters as nvarchar, when it should pass them as decimal/numeric. And furthermore, the values as passed as 67,1213 rather than 67.1213, which is the only format that SQL Server understands.

    The normal way to set up parameters in .NET is

    cmd.Parameters.Add("@par", SqlDbType.Numeric).Value = DiscountRateTB;
    cmd.Parameters["@par"].Precision = 18;
    cmd.Parameters["@par"].Scale = 5;

    (This is C# rather than VB .NET, but the principle is the same in VB-

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Olaf Helper 42,846 Reputation points

    Error converting data type nvarchar to numeric

    You get a pretty clear error message, you mix data types and a implicit / explicit data conversion fails, because the string source isn't convertable to a numeric.

    BTW, those screenshot aren't any helpfull, next please post code.