А>MSDN читал.
D>>Т.е. может еще попробовать " " " ' " (2-2-2-1-2)?
А>Пробовал много вариантов, в том числе и этот. Все равно не работает.
вообще именно так и должно работать. как ругается? я не поленился, сделал себе такой пароль, проверил — у меня работает, да и по доке:
The basic format of a connection string includes a series of keyword/value pairs separated by semicolons. The equal sign (=) connects each keyword and its value. To include values that contain a semicolon, single-quote character, or double-quote character, the value must be enclosed in double quotation marks. If the value contains both a semicolon and a double-quote character, the value can be enclosed in single quotation marks. The single quotation mark is also useful if the value starts with a double-quote character. Conversely, the double quotation mark can be used if the value starts with a single quotation mark. If the value contains both single-quote and double-quote characters, the quotation mark character used to enclose the value must be doubled every time it occurs within the value.
получается два варианта
" " " ' " (
2-2-2-1-2)
' " ' ' ' (
1-2-1-1-1)
у меня работают оба.
есть еще способ — берете SqlConnectionStringBuilder:
SqlConnectionStringBuilder sсb = new SqlConnectionStringBuilder( );
sсb.WorkstationID = "localhost";
sсb.DataSource = "Nortwind";
sсb.UserID = "sa";
sсb.Password = "\"'";
string conn_string = sb.ConnectionString;
получится тоже самое.