Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connect to MySQL database from ASP.Net MVC

im quit new to the ASP.Net MVC World. But i can't find any examples of, how to connect to an MySQL Database server from an ASP.Net MVC website. Anybody who can help?

like image 859
mortenstarck Avatar asked Apr 30 '12 09:04

mortenstarck


People also ask

How connect MySQL to MVC?

Installing and adding reference of MySql ConnectorRight Click the Project in Solution Explorer and click Manage NuGet Packages from the Context Menu. 2. Now you will need to look for MySql. Data package and once found, you need to click the Install Button.

Can ASP Net connect to MySQL?

To Connect to a MySQL Database Using ASP.NETFind your database's connection strings (Plesk). Note: Change the your password value to your real database password value. Using Microsoft Visual Studio . NET create an ASP.NET Project.

Can we connect MVC to database?

Click on the Create button and it will update the Index view as well add this new record to the database. Now let's go the SQL Server Object Explorer and refresh the database. Right-click on the Employees table and select the View data menu option. You will see that the record is added in the database.

Can you connect MySQL to Visual Studio?

To create a connection to an existing MySQL database: Start Visual Studio and open the Server Explorer by clicking Server Explorer from the View menu. Right-click the Data Connections node and then select Add Connection.


1 Answers

Description

At first you need to download theMySQLConnector. Then you can use the Entity Framework or the SqlCommand to connect to your database.

More Information

  • MySQL Connector for .NET
  • MySQL Entity Framework Tutorial
like image 75
dknaack Avatar answered Sep 30 '22 09:09

dknaack