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

A

andy

Hi all,

Any help much appreciated - Andy

I am trying to connect to a SQL Server DB using c#, ADO.Net

mySqlConnection = new
SqlConnection(@"user=ddd;password=€jfn¾;server=srv5;Trusted_Connection=no;database=dan");

as you can see there are "special" ASCII chars in the user and password
fields. (ASCII 127 and ASCII 157). The following error results when
trying to connect, where index 5 is the '' char in the user name.

"Format of the initialization string does not conform to specification
starting at index 5."
StackTrace

at System.Data.Common.DBConnectionString.GetKeyValuePair(Char[]
connectionString, Int32 currentPosition, String& key, Char[] valuebuf,
Int32& vallength, Boolean& isempty)\r\n
at System.Data.Common.DBConnectionString.ParseInternal(Char[]
connectionString, UdlSupport checkForUdl, NameValuePair& keychain)\r\n
at System.Data.Common.DBConnectionString..ctor(String
connectionString, UdlSupport checkForUdl)\r\n
at System.Data.SqlClient.SqlConnectionString..ctor(String
connectionString)\r\n
at System.Data.SqlClient.SqlConnectionString.ParseString(String
connectionString)\r\n
at System.Data.SqlClient.SqlConnection.set_ConnectionString(String
value)\r\n
at System.Data.SqlClient.SqlConnection..ctor(String
connectionString)\r\n
at HowTo.Samples.ADONET.sqldtreader.Run()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top