ERROR[07006]...violation (SQL_C_NUMERIC)
"Bruce Norgan" <[email protected]>
| Newsgroups | gmane.comp.db.mysql.odbc |
|---|---|
| Message-ID | <000801c7740c$70ca3c80$4a8ec942@W2K> |
I have a decimal (5,2) database field to update. The code is:
Dim strSQL As String = "Update table Set cost=? Where recid=1"
Dim cmdSQL As New OdbcCommand (strSQL, cnDbase)
Dim prmCost As New OdbcParameter ("?", OdbcType.Decimal)
Dim decCost As Decimal = Convert.ToDecimal (textbox.Value)
prmCost.Precision = 5
prmCost.Scale = 2
prmCost.Value = decCost
cmdSQL.Parameters.Add (prmCost)
cmdSQL.ExecuteNonQuery()
A server error occurs upon execution of "ERROR[07006][MySQL][ODBC 3.51 Driver][mysqld-4.0.27-max-log] Restricted data type attribute violation (SQL_C_NUMERIC)." There is no mention of this SQLSTATE error in the MySQL documentation of Appendix C.1 (server) or C.2 (client).
One reference says that when data is retrieved from a decimal field the ODBC driver uses a SQL_C_NUMERIC data conversion type. However, if the driver does not support the type then an error may occur. ODBC 3.0 drivers are supposed to have this C data type to allow applications to directly handle numeric data. The MySQL, ODBC 3.51 driver supposedly handles these types.
Thanks for any help.
Bruce