0

I just started off on ASP.NET. Iam trying to configure a connection string on web.config so that it can connect to mysql database on localhost:3307 port. This is a sample code of what i have

<add name ="client" connectionString ="localhost:3307" providerName="System.Data.SqlClient"/>

And again any link on how to allow iis to access my server will be appreciated

zx81
  • 41,100
  • 9
  • 89
  • 105
Ndeto
  • 315
  • 6
  • 17
  • http://stackoverflow.com/questions/15554290/asp-net-mysql-access-denied-for-user-localhost-using-password-no – Sathish D Nov 27 '13 at 09:55

2 Answers2

0

I had an older website that needed upgrading. Took me a couple of days to change

DRIVER={MySQL ODBC 5.1 Driver}

to

Driver={MySQL ODBC 5.2 ANSI Driver}

I tried dozens of things before I stumbled onto this one. Add it to your list of things to try.

jak
  • 1
  • 1
    Welcome to Stack Overflow! Suggestions should be placed as a comment rather than as an answer. – Joe C Jan 20 '17 at 21:49
-1

On your web.config add this connection:

  <connectionStrings>
    <add name="ConnStringDb1" connectionString="Data Source=localhost;Initial Catalog=YourDataBaseName;Integrated Security=True;" providerName="System.Data.SqlClient" />
  </connectionStrings>

Then use ConfigurationManager to get this:

using System.Data.SqlClient;
using System.Configuration;

    string connectionString = ConfigurationManager.ConnectionStrings["ConnStringDb1"].ConnectionString;

    using(SqlConnection SqlConnection = new SqlConnection(connectionString));

Then you can run Sql commands based on this connection, you don't need to configure IIS. Here is a simple tutorial of how to do this!

Zaki
  • 5,540
  • 7
  • 54
  • 91
  • Lemme check on That ASAP – Ndeto Nov 27 '13 at 10:13
  • Sorry, asi said i just started.. When you say i get configuration manager to get System.Dat.SqlClient; Using System.Configuration, Do you mean this configuration manager? because im having trouble doing that .. heresa screen shot of what i have https://docs.google.com/file/d/0B0yUEFSpKSxmSlNqLVByR05tT2c/edit – Ndeto Nov 27 '13 at 10:30
  • try this https://drive.google.com/file/d/0B0yUEFSpKSxmSlNqLVByR05tT2c/edit?usp=sharing – Ndeto Nov 27 '13 at 10:49
  • right click on your project/web solution and add reference..you dont need that screen – Zaki Nov 27 '13 at 11:29
  • Question is about mysql, not SQL server. – Himalaya Garg Sep 15 '21 at 08:08