Click here to Skip to main content
15,891,253 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am trying to connect to an Mysql database through c# web service
The password for the database is a~Sz4x;1)X(N The above password has ;(SPECIAL CHARACTER) in it which is a line terminator in c# it throws below error
Format of the initialization string does not conform to specification starting at index 70.
Any help will be appreciated.
Posted
Updated 29-Apr-15 1:26am
v2
Comments
CHill60 28-Apr-15 9:20am    
The fact that ";" is a line terminator is irrelevant - the password should be enclosed in a string. I suggest that you check your connection string again
Member 10983224 28-Apr-15 11:28am    
Hi this is the connection string i am using can you suggest

string connString = "SERVER=example.com" + ";" +
"DATABASE=db_beta;" +
"UID=db_demo;" +
"PASSWORD=a~Sz4x;1)X(N;";

Use this:
C#
string connString = @"SERVER=example.com;DATABASE=db_beta;UID=db_demo;PASSWORD=a~Sz4x;1)X(N;";


For further information, please see: 2.4.4.5 String literals[^]
 
Share this answer
 
Try this :
C#
string connString = @"SERVER=example.com;DATABASE=db_beta;UID='db_demo';PASSWORD='a~Sz4x;1)X(N';";


or this:

C#
string connString = "SERVER=example.com" + ";" +
"DATABASE=db_beta;" +
"UID='db_demo';" +
"PASSWORD='a~Sz4x;1)X(N';";
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900