Mega Code Archive

 
Categories / Delphi / ADO Database
 

Invalid field type when creating odbc datasource

Question and Answer Database FAQ: FAQ4667B - Invalid Field Type when creating ODBC DataSource Category: Database (ODBC) Platform: All Windows Product: All-CBuilder, BC++5.x, C++Builder1.0, C++Builder3.x, C++Builder4.x, Delphi2.x, Delphi3.x, Delphi4.x, VdBase7.x, Question: I'm using BatchMove to create a table in an ODBC DataSource. How come I'm getting the error "Invalid Field Type"? Answer: This error occurs for ODBC drivers where SQLGetTypeInfo(SQL_DOUBLE) returns a result set. In this case, the result is float is attempted to be created on the DataSource even though the DataSource does not support floats. A clasic example of this is Microsoft or Oracle's ODBC driver for Oracle. There two possible solutions: 1. Use the Native driver (SQL Links) driver for the Database if one exists 2. Create the table yourself and use BatchAppend instead of BatchCopy.