Click here to Skip to main content
16,016,489 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Connection String code:
HTML
<add key="constring" value=" provider connection string="Data Source=192.240.97.122; Initial Catalog=#####; User ID=######; Password=#####;"/>


this is my Strace Stack:

[ArgumentException: Format of the initialization string does not conform to specification starting at index 101.]
System.Data.Common.DbConnectionOptions.GetKeyValuePair(String connectionString, Int32 currentPosition, StringBuilder buffer, Boolean useOdbcRules, String& keyname, String& keyvalue) +5313265
System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey) +124
System.Data.Common.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms, Boolean useOdbcRules) +95
System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) +59
System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) +24
System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) +167
System.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key) +61
System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) +66
Posted
Updated 18-Jun-15 1:37am
v2
Comments
Sreekanth Mothukuru 18-Jun-15 8:27am    
Your connection string should have three attributes "Name", "ConnectionString" and "providerName"

Change your connection string like this.

XML
<add key="constring" value="Server=192.240.97.122;Database=#####;User ID=######; Password=#####;"/>
 
Share this answer
 
Comments
CHill60 18-Jun-15 9:18am    
OP will still need providerName="System.Data.SqlClient" before the "/>"
Member 11765235 18-Jun-15 10:00am    
I try this solution but Unfortunaly I have even error
See the example posted here[^] for the correct format
 
Share this answer
 
Comments
Member 11765235 18-Jun-15 10:07am    
I have to use "add Key"
CHill60 18-Jun-15 10:46am    
Why?
Try <add key="constring" value="Data Source=192.240.97.122;Initial Catalog=#####;User ID=######;Password=#####;" providerName="System.Data.SqlClient" /> ... which is copied from the link I provided, substituting your data into it
Member 11765235 18-Jun-15 11:13am    
it said that providerName attribute is not allowed.What can I do?
CHill60 18-Jun-15 12:38pm    
what said that? if it where you are using the connection string then post that code

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