Writing and reading Unicode in ASP.net
I need to read and write Unicode text data to a MySQL 4.1.19 database using ASP.net - not, I suggest, an unreasonable requirement in the global society of the 21st century.
My options seem to be to use Connector/net 5.0 or MyODBC 5.0. By its own admission MyODBC 3.51 does not support Unicode; MyOLEDB doesn't look useful but I could be wrong.
After extensive research and writing of test programs I have established the following -
Connector/net 5.0 does not write Unicode to a VARCHAR field, does read Unicode from VARCHAR, does not write Unicode to TEXT, does read Unicode from TEXT, SELECT LAST_INSERT_ID() works
MyODBC 3.51 does not write Unicode to a VARCHAR field, does not read Unicode from VARCHAR, does not write Unicode to TEXT, does not read Unicode from TEXT, SELECT LAST_INSERT_ID() works
MyODBC 5.0 does write Unicode to a VARCHAR field, does read Unicode from VARCHAR, does write Unicode to TEXT, does not read Unicode from TEXT (fails 65535), SELECT LAST_INSERT_ID() fails (65531)
So to summarise if you want to insert a record with data in a Unicode text field, get its record id, then read the text, you need to -
1. Insert and select last_insert_id() using Connector/net 5.0 or MyODBC 3.51
2. Update the text field using MyODBC 5.0
3. Select using Connector/net 5.0
Not a very satisfactory situation in my view so, please, somebody tell me I've got it all wrong and what I should be doing is...
Richard
Edited 1 time(s). Last edit at 05/03/2007 01:08PM by Richard Creer.