Using MySQL database with ASP.NET

Dec 28, 2011   //   by Jagan Krishnaraj   //   ASP, ASP.Net, MySQL, Servers, SQL Server  //  1 Comment

Introduction

Back in days of classic ASP if you require to build a database driven website the only choice to invest lot of money in buying a standard license of Microsoft SQL Server, or to adhere to the limitations of Microsoft Access. Luckily these days has one another affordable alternative that performs similar to MS SQL Server, that is MySQL. MySQL is completely free, and it is loaded with all the features are comparable to MS SQL Server.

In the following section i will discuss about how to use MySQL data base with ASP.NET.

First Step – Installation.

Download and install MySQL database to your local computer.

It will just install MySQL database as a standalone app, You need to write a command line in command prompt to create a database or to perform queries, which will not be the good idea. Hence download MySQL Workbench which is GUI tool to manage MySQL database on local machine.

(or)

All the PHP MySQL users know that there is tool call Xampp, that reduces complexity in installing and configuring Linux server with MySQL database in local machine.  You can download and install Xampp as a complete package that will install latest version of MySQL database on your local machine.

Connecting MySQL database from Microsoft Visual studio

Once you installed MySQL database and successfully made a connection to MySQL database from MySQL workbench, you are now ready to use the data base with ASP.NET

Open Microsoft visual Studio

In Server explorer -> Right click Data connections-> add new connection

Add-mysql-connection-asp.net

Add-mysql-connection-asp.net

The following dialog will be displayed. Now click on change that is next to Data source

add-mysql-connection-visual-studio

add-mysql-connection-visual-studio

In the following dialog box that is displayed, select “Microsoft OdBC Driver” and then click ok

Scroll down data source specification and select “MYSQLAPP” (If you don’t find it there you have follow this tutorial to install Microsoft ODBC driver for MySQL)

Then in the login information the default user name is “root” and the password is nill. After providing the values click on test connection, it will say connection is successfull. Now

Now the MySQL database will be listed under Data connections in server explorer. You can use it similar to MS SQL Server.

You can use it for grid view, listview etc. The users of your MySQL database driven ASP  web application, will very never realize that you use MySQL instead of MS SQL Server.

 

Related Posts

Post comment as twitter logo facebook logo
Sort: Newest | Oldest

Trackbacks

  1. [...] force use of forward only cursors   Now you are ready to use MySQL database with ASP.NET use this tutorial Using MySQL with ASP.NET [...]

Recommend us on Google!
Click to Subscribe

, Chennai, India.
Web development is my Passion
Programmer - Blogger - Creator

I Support Open Source