Results 1 to 4 of 4

Thread: Strange problem

  1. #1
    Join Date
    Feb 2006
    Posts
    2

    Default Strange problem

    I am working on a simple example, however I continue to get the following error upon execution:

    Code:
    PropertyAccessExceptionsException (1 errors); nested PropertyAccessExceptions are: \n[Spring.Objects.MethodInvocationException: Property 'ConnectionString' threw exception., Inner Exception: System.ArgumentException: Format of the initialization string does not conform to specification starting at index 0.\r\n   at System.Data.Common.DbConnectionOptions.GetKeyValuePair(String connectionString, Int32 currentPosition, StringBuilder buffer, Boolean useOdbcRules, String& keyname, String& keyvalue)\r\n   at System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey)\r\n   at System.Data.Common.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms, Boolean useOdbcRules)\r\n   at System.Data.SqlClient.SqlConnectionString..ctor(String connectionString)\r\n   at System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous)\r\n   at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(String connectionString, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions)\r\n   at System.Data.SqlClient.SqlConnection.ConnectionString_Set(String value)\r\n   at System.Data.SqlClient.SqlConnection.set_ConnectionString(String value)
    I get this error when I create an XmlObjectFactory and call GetObject("Database"). This is what my configuration file looks like, any suggestions?

    Code:
    <?xml version="1.0" encoding="utf-8" ?>
    <objects xmlns="http&#58;//www.springframework.net">
    	<object name="Database" 
                singleton="false"
                type="SpringDemo.Database, SpringDemo">
    		<property name="Connection" ref="SqlConnectionObject" />
    		<property name="Command" ref ="SqlCommandObject" />
    	</object>
    	<object name="SqlConnectionObject" 
    			singleton="false" 
    			type="System.Data.SqlClient.SqlConnection, System.Data">
    		<property name="ConnectionString" value ="Testing" />
    	</object>
    	<object name="SqlCommandObject"
    			singleton="false"
    			type="System.Data.SqlClient.SqlCommand, System.Data">
    	</object>
    </objects>

  2. #2
    Join Date
    Dec 2005
    Location
    Lyon, France
    Posts
    23

    Default

    Hello, I'm not sure but i think the problem is

    Code:
    value ="Testing"
    Connection strings have a specified format, you can't set a simple string "Testing", try with a real connection string.

    Ben

  3. #3
    Join Date
    Feb 2006
    Posts
    2

    Default

    I have actually tried a valid connection string, in fact in the demo I don't even attempt to actually connect yet. Passing an invalid connection string to the ConnectionString property of a SqlConnection should not cause the error I am seeing above.

  4. #4
    Join Date
    Sep 2004
    Location
    Belgrade, Serbia
    Posts
    613

    Default

    Actually, according to your stacktrace it looks like it does. Try using valid SqlClient connection string and see what happens.

    Regards,

    Aleks

Similar Threads

  1. Strange problem
    By eboix in forum AOP (Aspect Oriented Programming)
    Replies: 2
    Last Post: 04-10-2006, 01:24 PM
  2. Replies: 11
    Last Post: 02-22-2006, 02:35 PM
  3. Replies: 3
    Last Post: 01-23-2006, 02:20 PM
  4. Problem configuring - newbee
    By jiffyjub99 in forum Core Container
    Replies: 8
    Last Post: 11-14-2005, 09:19 AM
  5. Problem with getting config on Mono
    By arsenjew in forum Mono Development
    Replies: 2
    Last Post: 04-25-2005, 04:14 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •