Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Moderated Pro PHP
|
Moderated Pro PHP This is a moderated forum for discussing advanced, professional level issues with PHP. Your posts will not appear until a moderator approves them. Posts that are not the right level for this forum will be responded to and you'll be asked to post them in the [url="http://p2p.wrox.com/sql-server-2000-20/9"]Beginning PHP[/url] forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Moderated Pro PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 1st, 2007, 10:01 AM
Authorized User
 
Join Date: Aug 2003
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Default MySQL SQL_C_NUMERIC violation

I have a MySQL decimal(5,2) 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: "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. Your help would be much appreciated.
Bruce






Similar Threads
Thread Thread Starter Forum Replies Last Post
Concurrency Violation Problem - Please HELP! Aaron Edwards ASP.NET 2.0 Basics 0 March 25th, 2007 08:17 PM
Concurrency Violation Problem - Please HELP! Aaron Edwards ADO.NET 1 March 25th, 2007 08:15 PM
Error 'SQL_C_NUMERIC' with param Insert query bnorg MySQL 0 December 16th, 2006 07:30 PM
Access Violation ? T-5 Beginning PHP 1 July 24th, 2004 09:29 PM
primary key violation muralikeane Classic ASP Databases 8 May 21st, 2004 09:24 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.