Cannot convert type error when using GetFieldNames
Posted: Tue 11 Oct 2005 12:07
First some background: My Delphi 7 client-server database app tries to work with whatever database the user specifies, be it Interbase, MS-SQL or Oracle. Things worked fine until I tried to run it on MS Server 2003 against a MS-SQL 2000 database. I would instantly get an A/V but that problem disappeared when I installed the latest version of dbexpsda.dll.
Happy days – and while I’m updating dll’s I thought I’d grab the latest dbexpoda.dll v2.50 in case Oracle type nasties that may affect me had similarly been fixed.
To make my multiple database type app work I need a line like:
when I’m connecting to Oracle otherwise I get type mismatch problems with my TFloatFields permanent fields. (Interbase and MSSQL Server cope fine with TFloatFields).
Now the problem: I’ve noticed that my call to:
now returns an empty list of field names when using this new dbexpoda.dll. A trapped exception apparently is raised within the procedure with the message 'Cannot convert type.'
I don’t get this problem if I replace the v2.50 dbexpoda.dll with my faithful old v1.87 dbexpoda.dll. Over the years I’ve got quite familiar with 'Cannot convert type’ errors and I in this case found that setting coEnableBCD Option to True fixed GetFieldNames. Unfortunately, of course, all my TFloatFields kick up a fuss if I do that!
This GetFieldNames behaviour happens with Oracle 10g, 9.2, 8.1.7. PS. Please don’t ask whether I can change the database schema because we’ve got a large installed user base, also I’m keeping my TFloatFields because a quick search shows I’ve got over 1,700 of them!!
How can I get GetFieldNames to work without switching coEnableBCD option to true like I could in the good old days?? Until then I’ll use the ‘old’ dbexpoda.dll.
Happy days – and while I’m updating dll’s I thought I’d grab the latest dbexpoda.dll v2.50 in case Oracle type nasties that may affect me had similarly been fixed.
To make my multiple database type app work I need a line like:
Code: Select all
myCRSQLConnection.SQLConnection.SetOption(coEnableBCD, Integer(False));Now the problem: I’ve noticed that my call to:
Code: Select all
myCRSQLConnection.GetFieldNames(tname, fieldNameList);I don’t get this problem if I replace the v2.50 dbexpoda.dll with my faithful old v1.87 dbexpoda.dll. Over the years I’ve got quite familiar with 'Cannot convert type’ errors and I in this case found that setting coEnableBCD Option to True fixed GetFieldNames. Unfortunately, of course, all my TFloatFields kick up a fuss if I do that!
This GetFieldNames behaviour happens with Oracle 10g, 9.2, 8.1.7. PS. Please don’t ask whether I can change the database schema because we’ve got a large installed user base, also I’m keeping my TFloatFields because a quick search shows I’ve got over 1,700 of them!!
How can I get GetFieldNames to work without switching coEnableBCD option to true like I could in the good old days?? Until then I’ll use the ‘old’ dbexpoda.dll.