ADO MyODBC 3.51 MySQL problem with field sizes (ActualSize & DefinedSize)
Posted on 2006-06-15
It's really very simple.
If you have a table with few varchar(255) fields, and you open it through ado, it doesn't give you the real field size, but instead is giving you (I think) the maximum lenght found for all values on that column. On my fields it is giving me all different values for ActualSize & DefinedSize for all varchar(255) fields, which is then making huge problems with my code!
I've read somewhere that this can be fixed with altering the connection string, but the author didn't say how :(
Here's some sample code:
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
rs.Open "SELECT * FROM table", cn, adOpenStatic, adLockOptimistic
MsgBox rs.Fields(0).ActualSize ' shows 10
MsgBox rs.Fields(0).DefinedSize ' shows 10
there's only one record there, and it is holding the value of '1234567890' in a single varchar(255) field.
How can I get the real field size!?!?!
Big thanks in advance