Click here to Skip to main content
15,945,119 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Dear guys,
I have a small prob when trying to load datareader object into datatable
special if the object of datareader have column of LONGTEXT DataType "am use mysql database"
when convert datatype to "Text" the problem is solved,
My questions :
1- what's the difference between LONGTEXT and TEXT?
2- how to fix this problem without convert the datatype to TEXT?

The Error Message at DataTable.GetErrors() is "Column 'photo_file' exceeds the MaxLength limit."
Herman<T>.Instance 14-Nov-12 9:12am    
The error says it. ou have a LONGText block. The size of that object is larger than a string value can hold. Like trying to parse a 64bit int in a 32 bit. After some number this fails
Ahmad Abou Hamdh 14-Nov-12 14:59pm    
no my friend cause the text length not more than 10 characters
Herman<T>.Instance 16-Nov-12 4:13am    
then cast the field in the qery as Text
Kschuler 14-Nov-12 12:33pm    
To get more detailed help, please click the Improve Question link and add the relevant code to your question. This will help us understand more about your problem.
Killzone DeathMan 26-Nov-12 11:24am    
Just do not use a DataReader...
Use a DataAdapter and a DataSet...
Something like:

MySQLConnection conn = new MySQLConnection(connectionstring);
DataAdapter adapter = new DataAdapter("SELECT * FROM TEST", conn);
DataSet ds = new DataSet();
DataTable table = ds[0];

I am not sure, but you must download the mysql connector...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900