connecting to mysql database from visual studio

rohitvishnu

rohitvishnu

@rohitvishnu-aLqdqe Oct 26, 2024
hi
how do i connect to a mysql database from visual studio 2008? i'm not able to create an odbc data source either, as there is no driver installed for it.

Replies

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform

  • slashfear

    slashfear

    @slashfear-tSWzpz Apr 23, 2009

    Hi Rohit,

    You can either use ODBC or MySql Client for .NET.
    1. Download MySql Client dll.​
    2. Add the dll to your project.​
    3. Add connection string to web.config​
    <connectionStrings>
    <add name="Connstring" connectionString="server=localhost; userid=uid;password=pwd;pooling=yes;Database=DB" providerName="MySql.Data.MySqlClient"/>
    </connectionStrings>
    <system.data>
    <DbProviderFactories>
    <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=5.0.2.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/>
    </DbProviderFactories>
    </system.data>​
    That's it you can follow same sqlclient connection.​



    And you can have a look at this detailed tutorial and you can download the plugins from the below link: #-Link-Snipped-#

    Hope this helps!!!! :smile: