|
From: "Bruce Norgan" on 31 Mar 2007 22:19 ------=_NextPart_000_0005_01C773C9.618C3DB0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I have a decimal (5,2) database field to update. The code is: Dim strSQL As String =3D "Update table Set cost=3D? Where recid=3D1" Dim cmdSQL As New OdbcCommand (strSQL, cnDbase) Dim prmCost As New OdbcParameter ("?", OdbcType.Decimal) Dim decCost As Decimal =3D Convert.ToDecimal (textbox.Value) prmCost.Precision =3D 5 prmCost.Scale =3D 2 prmCost.Value =3D 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 ------=_NextPart_000_0005_01C773C9.618C3DB0--
From: Jess Balint on 1 Apr 2007 14:05 On Sat, Mar 31, 2007 at 07:18:36PM -0800, Bruce Norgan wrote: > 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). This error is returned from SQLBindParameter, and is an ODBC state (not MySQL-specific). See: http://msdn2.microsoft.com/en-us/library/ms710963.aspx > 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. The type refered to (SQL_C_NUMERIC) is a special structure used for precise representation of floating point values. MySQL Connector/ODBC v3 does not support this, but it supported in the beta v5 driver. Code reference (driver/prepare.c:245): --------------- if (fCType == SQL_C_NUMERIC) /* We don't support this now */ { set_error(stmt,MYERR_07006, "Restricted data type attribute violation(SQL_C_NUMERIC)",0); MYODBCDbgReturnReturn(SQL_ERROR); } --------------- Hope this helps, Jess -- MySQL ODBC Mailing List For list archives: http://lists.mysql.com/myodbc To unsubscribe: http://lists.mysql.com/myodbc?unsub=myodbc(a)freebsd.csie.nctu.edu.tw
|
Pages: 1 Prev: April Newsletter Next: for nolan: extremely tempting groups - ulja - (1/1) |