问题描述
连接字符串代码:
Connection String code:
<add key="constring" value=" provider connection string="Data Source=192.240.97.122; Initial Catalog=#####; User ID=######; Password=#####;"/>
这是我的Strace Stack:
[ArgumentException:初始化字符串的格式不符合规范从索引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 definitions,Boolean firstKey)+124
System.Data.Common.DbConnectionOptions..ctor(String connectionString ,Hashtable peers,Boolean useOdbcRules)+95
System.Data.SqlClient.SqlConnectionString..ctor(String connectionSt ring)+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
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
推荐答案
<add key="constring" value="Server=192.240.97.122;Database=#####;User ID=######; Password=#####;"/>
这篇关于初始化字符串的格式不符合从索引99开始的规范。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!