Sunday, 21 April 2013

MYSQL C# string and byte confusion

While creating an application with C# and MYSQL as the back end  i encountered a problem where I expected the c# to return value as a string but then ended up getting  a {byte[]} as the result.

To get around this issue, and after lots of googling, i discovered the problem could easily be sorted from the connection string. Just add  "respect binary flags=false;" in your connection string. i.e

Server=svrName;Database=dbName;Uid=Usrname;Pwd=pwdName;respect binary flags=false;