Re: Invalid field size"
- From: Erik <erikpub@xxxxxxxxxxxxxxxxxx>
- Date: Thu, 09 Feb 2006 10:58:13 -0800
Matt wrote:
This seems to be a recurring problem using TADOQuery in D7.
D7 >> ODBC 3.51 >> MySQL5.0
I'm using just the ADOQuery component and a CONNECTION STRING, no
CONNECTION OBJECT, no DATASOURCE. I CLOSE the query, insert SQL and
OPEN it. Quite simple.
When I query a record that exists, the requested fields in the SQL are
returned and data is extracted from them. I can INSERT records in the
table as well as UPDATE a record with "ExecSQL". All that works fine.
When I request a record that doesn't exist in the table, I get the
"Invalid Field Size" error from ODBC when I try to OPEN the record
through D7 code (MySQL's command line client behaves normally!)
This particular error has been plaguing me for a year now, and seems
to arrive and depart all on its own (obviously I haven't found a
cure.) I'm sure my client won't be all that understanding so I really
need to understand this error behavior and deal with it. I don't want
to write an exception handler until I know WHY it's happening and can
predict its behavior.
TADOQuery is created with default properties, the only thing I change
on it is the connection string and SQL. No TParameters are used.
Not long ago MySQL/ODBC had this problem with CHAR() fields smaller
than 2 or 3 CHARs when they contained NULL. All my alphanumeric
fields are now VARCHAR(4) or larger which seemed to fix the problem.
The table has DATE, VARCHAR, MEDIUMINT fields, about a dozen total.
Any thots?
Are all ODBC 3.51's equal?
I had an issue with a similar problem and in order to solve
it, I had to do a lot of manual checking in order to tell if
1) a record was returned and then 2) if the value of a field
was NULL. I wound up writin my own "GetStringField" and
"GetIntField" sort of functions that would return a zero or an
empty string instead of a NULL.
There should be a better solution, but this is the one I came
up with.
.
- References:
- Invalid field size"
- From: Matt
- Invalid field size"
- Prev by Date: Re: read text file in c++ builder 6.0
- Next by Date: Re: dcc32.exe could not compile used unit System.pas
- Previous by thread: Invalid field size"
- Next by thread: Re: Project Options - Version Info
- Index(es):
Relevant Pages
|