Library tutorials & articles

Using MySQL with .NET

Introduction

Ever wanted to combine the power and ease of the .NET platform with a free database like MySQL? Well thanks to ODBC database functions in ADO.NET it's really easy. All you need is the latest drivers for ADO.NET and MySQL installed. For this tutorial we will use C# to build a simple application for reading a table built in MySQL. This assumes at least basic knowledge of C# and .NET.

Creating the Database

To start the project, we will need to create a mysql database to work with. Create a new database called mysqlsample and create a new table like this:

mysql> create database mysqlsample;

mysql> use mysqlsample;

mysql> create table tutorials (id int not null auto_increment, title varchar(80) not null, link varchar(255) not null, primary key(id));

mysql> insert into tutorials values (1, ‘DOT.NET For Dummies', ‘http://www.dotnetfordummies.com');

mysql> insert into tutorials values (2, ‘XML For Idiots', ‘http://www.xmlforidiots.com');

mysql> insert into tutorials values (3, ‘Windows For Wimps', ‘http://www.windowsforwimps.com');

Comments

  1. 13 Aug 2006 at 00:18

    HI a better way to Connect to a Mysql Database ould be using the Mysql Provided Connector. provides faster access provides suport for almost all mysql Functionality. you can check out the Following Link.

    http://dev.mysql.com/downloads/connector/net/5.0.html you get the connector along with a basic documnetion that will help you with Connecting to the Mysql database.
    being a Mysql fan will also tell people who do not want to have transaction support that mysql with a myisam type table is blazingly fast.

    regards

    David Xavier

  2. 01 Jan 1999 at 00:00

    This thread is for discussions of Using MySQL with .NET.

Leave a comment

Sign in or Join us (it's free).

AddThis

Related podcasts

  • Stack Overflow: Podcast #31

    This is the thirty-first episode of the StackOverflow podcast, where
Joel and Jeff discuss.. stuff!

Based on some comments from Podcast #30, we now know that “Learning about NP-Completeness from Jeff is like learning about irony from Alanis Morissette”. It’s funny b...

Related jobs

Events coming up

  • Jun 16

    Code Generation 2009

    Cambridge, United Kingdom

    A developer event with a practical focus on helping people get to grips with code generation tools and technologies.