Groups | Blog | Home
all groups > dotnet datatools > march 2005 >

dotnet datatools : Error grabbing text from MySQL


David P. Donahue
3/5/2005 7:34:28 PM
I'm running into a problem grabbing some text from a MySQL database in
my C# website. All the fields defined as "varchar" are working just
fine, but I'm using longer text fields defined as "text" in some cases
and I get the following error when I try to populate a DataSet with data
that includes such a field:

"Unknown target conversion type."

Any ideas how to get around this? The code that's grabbing the data and
putting it into the DataSet is as follows (sorry for any wrapping):

mySqlConnection = new
ByteFX.Data.MySqlClient.MySqlConnection(stringDatabaseConnection);
mySqlDataAdapter = new
ByteFX.Data.MySqlClient.MySqlDataAdapter(stringSelect, mySqlConnection);
dataSetSQL = new DataSet();
mySqlDataAdapter.Fill(dataSetSQL);

Has anyone run into a problem like this before? What have you done to
fix it? Any help would be much appreciated, thanks.


Regards,
David P. Donahue
David P. Donahue
3/6/2005 1:29:15 PM
FYI: Some more research on the MySQL side of things determined that
replacing the field name in the SELECT query with "CAST(FieldName AS
CHAR) FieldName" did the trick :)

Regards,
David P. Donahue
ddonahue@ccs.neu.edu



[quoted text, click to view]
AddThis Social Bookmark Button