Kbase 21031: Error 5890 When Updating an SQL Record from Progress
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  10/16/2008 |
|
Status: Unverified
SYMPTOM(s):
Error occurred while accessing component property/method: <property or method name>. Type mismatch. Error code: 0x80020009 <procedure-name> (5890)
Updating a SQL record using ADO
Inserting a SQL record using ADO
CAUSE:
This is usually the result of data type values incompatibility between Progress and SQL databases. What is a valid value for a Progress data type might not be a valid value for an SQL data type; consequently an update process can bring about the error. For instance, the unknown value stored in an SQL database is represented by the NULL keyword, however the question mark sign (?) is what symbolizes the unknown value stored in a Progress database. Therefore, when a Progress program attempts to store a Progress unknown value into an SQL database field, validation is needed in order to avoid the data type values incompatibility that exists between those databases.
FIX:
Here, sample code demonstrates a data type values incompatibility between Progress and SQL databases fields. The example uses conditional statements in order to avoid that incompatibility and to store those values into SQL properly. It is assigned to the CommandText attribute of a com-handle object reference inside a Progress program.
<com-handle-variable>:CommandText = "INSERT INTO PUB.salesrep
([Sales-Rep],[Rep-Name],Region,
[Rep-Active],[Last-Sales-Date],[Month-Quota])
VALUES
(" + STRING(Sales-Rep) + ",
'" + Rep-Name + "',
'" + Region + "',
" + STRING(Rep-Active, "0/1") + ",
" + (IF Last-Sales-Date = ? THEN "NULL" ELSE "'" +
STRING(Last-Sales-Date,"99/99/9999") + "'") + ",
'" + (Month-Quota[1] + ";" + Month-Quota[2] + ";"
+ Month-Quota[3] + ";" + Month-Quota[4] + ";"
+ Month-Quota[5] + ";" + Month-Quota[6] + ";"
+ Month-Quota[7] + ";" + Month-Quota[8] + ";"
+ Month-Quota[9] + ";" + Month-Quota[10] + ";"
+ Month-Quota[11] + ";" + Month-Quota[12]) + "' )":U.
The fields used in the Insert SQL Statement above are defined in the databases as follows:
Table: Salesrep
Field Name Progress SQL
Sales-Rep integer varchar
Rep-Name character varchar
Region character varchar
Rep-Active logical bit
Last-Sales-Date date smalldatetime
Month-Quota var/ext 12 varchar