Error 'SQL_C_NUMERIC' with param Insert query
With the code below I get "ERROR[07006]...Restricted data type attribute violation (SQL_C_NUMERIC)" when the query is executed. There is no mention of this SQLSTATE error in the MySQL documentation
of Appendix C.1 (server) or C.2 (client).
Dim strSQLSchedule As String = "INSERT INTO schedule " & _
"(crsno,sesno,schdate,cost) VALUES (?,?,?,?);"
Dim cmdSchedule As New OdbcCommand(strSQLSchedule, cnAqua)
With cmdSchedule.Parameters
.Add("?", OdbcType.SmallInt).Value = Convert.ToInt16(crsnum.Value)
.Add("?", OdbcType.SmallInt).Value = Convert.ToInt16(sesnum.Value)
.Add("?", OdbcType.DateTime).Value = Convert.ToDateTime(schedte.Value)
.Add("?", OdbcType.Decimal).Value = Convert.ToDecimal(costof.Value)
End With
cmdSchedule.ExecuteNonQuery()
Previously conversion/assignment for the integers and date was successful but when decimal processing was added the error occurred. Thanks for the help.
|