Although mysql-connector-Net (MySQL. data. DLL, MySQL DATA object.. net provider) has been unable to compile, there are two versions 5.1.4 and 5.2.2 In hand can not compile, so today simply find a way to completely solve this problem.
This problem is caused by compilation of the escapestring method in mysqlstring. For details, see:
Code
Private String Escapestring ( String S)
{
S = S. Replace ( " \\ " , " \\\\ " );
S = S. Replace ( " \' " , " \\\' " );
S = S. Replace ( " \ "" , " \\\ "" );
S = S. Replace ( " ` " , " \\' " );
S = S. Replace ( " ?, " \\ ? );
S = S. Replace ( " ?, " \\ ? );
S = S. Replace ( " ?, " \\ ? );
Return S;
}
In fact, the method is also very simple, but I didn't think of it for a moment. I just need to use reflector to view the mysqlstring class and decompile the correctCodeJust copy it out. The following is the correct code:
Code
Private String Escapestring ( String S)
{
S = S. Replace ( @" \ " , @" \\ " );
S = S. Replace ( " ' " , @" \' " );
S = S. Replace ( " \ "" , " \\\ "" );
S = S. Replace ( " ` " , @" \' " );
S = S. Replace ( " \ X00b4 " , " \\\ X00b4 " );
S = S. Replace ( " ' " , @" \' " );
S = S. Replace ( " ' " , @" \' " );
Return S;
}