This is a migrated thread and some comments may be shown as answers.

The selected connection string is invalid!

1 Answer 221 Views
Data Access Free Edition
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Mattias Engman
Top achievements
Rank 1
Mattias Engman asked on 06 Dec 2009, 01:21 PM
I just installed openaccess and tries to enable my project to use ORM in the Telerik menu in VS 2010.. I'm trying to connect to MySql by setting a custom defined connection string in the "enable project wizard", but only gets the alert message "The selected connection string is invalid!". I have tried all different connection string format I can think of, but still the same message... Should not the connection string look like this? "server=xxx.xxx.xxx.xxx; userid=xxxxx; password=xxxxxxxxx; database=dbname;"

Thanks for help
Best/Mattias

1 Answer, 1 is accepted

Sort by
0
Alexander
Telerik team
answered on 10 Dec 2009, 07:19 AM
Hello Mattias Engman,

It seems the MySql .NET Connector does not work with Visual Studio 2010 yet. That is why you are not able to set the connection string via the wizard as it requires a working database provider. However, you should be able to set the connection string manually in the config file. In the Enable project wizard set a connection to a database on the local SqlExpress server so the wizard will generate a configuration file with an <openAccess> section. Then edit just the connection strings to look like this:
<configuration>
  <configSections>
    <section name="openaccess" type="Telerik.OpenAccess.Config.ConfigSectionHandler, Telerik.OpenAccess.Config, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7ce17eeaf1d59342" requirePermission="false" />
  </configSections>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
  </startup>
  <connectionStrings>
    <add name="DatabaseConnection1" connectionString="server=localhost; userid=user; password=1234; database=test" providerName="MySql.Data.MySqlClient" />
  </connectionStrings>
  <openaccess xmlns="http://www.telerik.com/OpenAccess">
    <references />
    <connections>
      <connection id="DatabaseConnection1">
        <connectionString>server=localhost; userid=user; password=1234; database=test</connectionString>
        <backendconfigurationname>mysqlConfiguration</backendconfigurationname>
      </connection>
    </connections>
    <backendconfigurations>
      <backendconfiguration id="mysqlConfiguration" backend="mysql">
        <mappingname>mysqlMapping</mappingname>
      </backendconfiguration>
    </backendconfigurations>
    <mappings current="mysqlMapping">
      <mapping id="mysqlMapping" />
    </mappings>
  </openaccess>
</configuration>
Note that you have to change the connection string at two places, set "MySql.Data.MySqlClient" for providerName and change the "backend" attribute to "mysql". The places where you should do the changes are in bold style above. You may also have to add a reference to the mysql.data.dll assembly which can be found in the <OpenAccess install path>\bin directory. Hope that helps.

Regards,
Alexander
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Data Access Free Edition
Asked by
Mattias Engman
Top achievements
Rank 1
Answers by
Alexander
Telerik team
Share this question
or