Facebook Pixel

ASP.NET, C# and MySQL Integration Template

This example shows how to use AnyChart library with the C# programming language using ASP.NET and MySQL database.
View on GitHub


This example uses .NET framework 4.6.1, ASP.NET 4.0.30319, ASP.NET MVC 5.2, Visual Studio 2015 Community, MySQL 5.6 and MySQL Connector/NET - ADO.NET driver for MySQL. To check your installations, please, use Windows Control Panel -> Programs and features. If you miss some installations, please, visit:
MySQL download page and installation instructions to setup MySQL;
Visual Studio download page to install Visual Studio, .NET framework and ASP.NET;
Connector/Net download page to install MySQL Connector/NET.

To start this example run commands listed below.

Clone the repository from github.com to your working directory:

$ git clone git@github.com:anychart-integrations/asp-net-c-sharp-mysql-template.git

Open cmd console in 'asp-net-c-sharp-mysql-template' folder and set up MySQL database, use -u -p flags to provide username and password:

$  "[YOUR_PATH_TO_MYSQL]\bin\mysql.exe" -u[USER_NAME] -p < database_backup.sql
$  "C:\Program Files\MySQL\MySQL Server 5.6\bin\mysql.exe" -uroot -p < database_backup.sql

Open project in Visual Studio using AspNetCSharpMysqlTemplate.sln solution file

Run application using Run button or press F5

If you have some problems with MySQL connection, ensure that MySql.Data.Entity.EF6 in References has correct path to MySql.Data.Entity.EF6.dll


Your workspace should look like:

        RouteConfig.cs          # app routes
        ChartController.cs      # main controller
        style.css               # main css file
        fruit.cs                # Entity framework model for MySQL
        FruitDBContext.cs       # DB data provider
            Index.cshtml        # html template
    Web.config                  # main ASP.NET project settings


Further Learning


AnyChart ASP.NET/C#/MySQL integration sample includes two parts:

  • Code of the integration sample that allows to use Javascript library (in this case, AnyChart) with ASP.NET framework, C# language and MySQL database. You can use, edit, modify it, use it with other Javascript libraries without any restrictions. It is released under Apache 2.0 License.
  • AnyChart JavaScript library. It is released under Commercial license. You can test this plugin with the trial version of AnyChart. Our trial version is not limited by time and doesn't contain any feature limitations. Check details here.

If you have any questions regarding licensing - please contact us. sales@anychart.com