views:

1114

answers:

4

I wanted to use SubSonic as it said it would be easy to use and a time saver.

After 3 hours trying to get the connection string for MySQL right I'm about to give up on it.

Building configuration from C:\Documents and Settings\user\My Documents\Visual Studio 2

008\Projects\ConfigurationItems\ConfigurationItemsMVC\Web.config
Adding connection to MySqlDataProvider
ERROR: Trying to execute generate
Error Message: System.ArgumentException: Format of the initialization string does not conform to specification starting at index 0.

I can't shift this: Error Message: System.ArgumentException: Format of the initialization string does not conform to specification starting at index 0.

I get it every time I try and run subsonic.exe /generate

IT ALL LOOKED SO EASY!!!

Here is my Web.Config

<!-- connectionString="Persist Security Info=False;database=config;server=localhost;user id=config;Password=config" -->
  <connectionStrings>
    <remove name="ConfigConnectString"/>
    <add name="ConfigConnectString" connectionString="Persist Security Info=False;database=config;server=localhost;user id=userid;Password=password" providerName="MySql.Data.MySqlClient"
      />
    </connectionStrings>

  <SubSonicService defaultProvider="ConfigDatabase">
      <providers>
        <add type="SubSonic.MySqlDataProvider, SubSonic" 
             name="MySqlDataProvider" 
             generatedNamespace="Config" 
             connectionStringName="ConfigConnectString" 
             />

      </providers>
  </SubSonicService>

I've tried a few things:

  1. Specifying path to webconfig using /config on the external tool path.
  2. Downgrading from the 6.0 .NET MySQL connector to the latest 5.2 version in line with samples.
  3. Adding MySQL.Data as a reference direct from the SubSonic folder to the DLL in there.
  4. Trying various formats for the connection string, based off http://www.connectionstrings.com/mysql#28

( other connection string: "Server=localhost;Database=config;Uid=user;Pwd=password;"- also "blah" / "anything" throws the same error...)

No joy! Very close to giving up on SubSonic. Please help if you can!

Btw I am using Subsonic 2.2

+1  A: 

I guess it expects a '{0}' somewhere, as that is the error you get when you forget (IIRC).

leppie
do you mean the string '{0}', within the connection string?
Jim
Yes, you are probably supplying it, or it is looking for that.
leppie
I had fudged the default provider class - I suppose that was changing the format of the string somewhere down the line and not providing a '{0}' under the bonnet somewhere!
Jim
Glad you found it :)
leppie
+4  A: 

I'm an idiot:

 <SubSonicService defaultProvider="ConfigDatabase">

Should be:

 <SubSonicService defaultProvider="MySqlDataProvider">

Doh!

Jim
A: 

LOL! Thanks!! That's exactly what I did. =)

A: 

Yes you are, but you helped this idiot :) Must try remember this one!

Justin Porteous