Interrogating mySQL datatypes with ADO.NET

  • Thread starter Thread starter Mark Rae
  • Start date Start date
M

Mark Rae

Hi,

Interrogating the DataType property of a DataColumn object where the
underlying column in a mySQL table is CHAR, VARCHAR or TEXT returns
System.String for each. Is there a method to differentiate these underlying
datatypes and, if so, to interrogate the column length so that it will
return me, say, VARCHAR(20) instead of just System.String?

Any assistance gratefully received.

Best regards,

Mark Rae
 
I am not a MySql expert, but seems like this level of detail isn't built
into the provider you are using. You could verify that by decompiling it
using reflector. Worst case, you might want to write up your own schema
query mechanisms.

- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik
 
Mark said:
Core Lab MySQLDirect .NET Data Provider 2.30

That's an oldie :) They're at 2.70.1 at the moment.

To answer your original question, no, once the db type is converted to
the .net type, you're stuck with the .NET type, as the db type is not
that interesting (in theory).

If you want to know the db type, you can always use the describe table
command of mysql, or use the trick with the command builder (create a
command using the command builder object, and check which type is
created for the parameters for the various fields)

Frans.
 
That's an oldie :) They're at 2.70.1 at the moment.

To answer your original question, no, once the db type is converted to the
.net type, you're stuck with the .NET type, as the db type is not that
interesting (in theory).

If you want to know the db type, you can always use the describe table
command of mysql, or use the trick with the command builder (create a
command using the command builder object, and check which type is created
for the parameters for the various fields)

OK - thanks.
 
Back
Top