Specify password in mysql connection string

from C# program i have connect to mysql database how to specify a password with a single quote character, for get next error

Format of the initialization string does not conform to specification
starting at index 

for this connection string

Server = srv; Database = db; User Id = user; Password = 'ktrnhjyyst;

Thanks

Upvotes: 0

Views: 1671

Answers (1)

Alex K.
Alex K.

Reputation: 175748

You need to quote tokens that contain restricted chars:

var cn = "Server=srv;Database=db;User Id=user;Password=\"'ktrnhjyyst;\"";

Upvotes: 2

Related Questions