dotConnect for MySQL Documentation
Devart.Data.MySql Namespace / MySqlConnection Class / BackslashEscapesMode Property
Example

BackslashEscapesMode Property (MySqlConnection)
Manages EscapeString. It can be set to Enabled, Disabled, or Auto.
Syntax
'Declaration
 
Public Property BackslashEscapesMode As BackslashEscapesMode
 

Property Value

The default property in Disabled specifies the use of EscapeString substitution. It can be set to one of three modes:

* Enable means that BACKSLASH_ESCAPES is allowed.

* Disable means that BACKSLASH_ESCAPES is not allowed.

* Auto means that you want to check whether the NO_BACKSLASH_ESCAPES mode is enabled or disabled in the SESSION.sql_mode of the database. Based on this, you can set the mode to either Enabled or Disabled.

Remarks
The Auto mode works as follows: the check is performed in the database once, and based on sql_mode, BackslashEscapesMode is set to either Enable or Disable. If you need to change BackslashEscapesMode for each Execute, you have the option to do so. The BackslashEscapesMode option can be set each time using connection.BackslashEscapesMode.
Example
Here is an example for C#:
MySqlConnection connection = new MySqlConnection(@"
User Id=...;
Password=...;
Host=...;
Port=...;
BackslashEscapesMode=Enable;
MySqlConnection connection = new MySqlConnection(@"
User Id=...;
Password=...;
Host=...;
Port=...;
");
connection.BackslashEscapesMode = BackslashEscapesMode.Enable;
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also