Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When storing a MySQL connection string in App.config, what value should the providerName property be set to?

When storing a MySQL connection string in App.config, what value should the providerName property be set to?

For example in the below App.config file, what value should I use for the providerName? Does it matter?

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <connectionStrings>
    <add name="MySQL" connectionString="SERVER=8.8.8.8; DATABASE=foo; UID=bar; PASSWORD=foobar" providerName="WhatGoesHere?" />
  </connectionStrings>
</configuration>
like image 769
JMK Avatar asked Nov 28 '12 14:11

JMK


People also ask

What is connection string providerName?

The providerName attribute is used to set the name of the .NET Framework data provider that the DataSource control uses to connect to an underlying data source. If no provider is set, the default is the ADO.NET provider for Microsoft SQL Server.

Where should you store connection string information?

Connection strings in configuration files are typically stored inside the <connectionStrings> element in the app. config for a Windows application, or the web. config file for an ASP.NET application.


1 Answers

Try this:

<connectionStrings>
<add name="MySQL" connectionString="SERVER=8.8.8.8; DATABASE=foo; UID=bar; PASSWORD=foobar" providerName="MySql.Data.MySqlClient" />
</connectionStrings>
like image 86
JofryHS Avatar answered Nov 15 '22 20:11

JofryHS