Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/content/f/e/r/ferasferas1/html/scriptslibrary/libraries/joomla/database/database.php:2) in /home/content/f/e/r/ferasferas1/html/scriptslibrary/libraries/joomla/session/session.php on line 423

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/content/f/e/r/ferasferas1/html/scriptslibrary/libraries/joomla/database/database.php:2) in /home/content/f/e/r/ferasferas1/html/scriptslibrary/libraries/joomla/session/session.php on line 423

Warning: Cannot modify header information - headers already sent by (output started at /home/content/f/e/r/ferasferas1/html/scriptslibrary/libraries/joomla/database/database.php:2) in /home/content/f/e/r/ferasferas1/html/scriptslibrary/libraries/joomla/session/session.php on line 426

Warning: Cannot modify header information - headers already sent by (output started at /home/content/f/e/r/ferasferas1/html/scriptslibrary/libraries/joomla/database/database.php:2) in /home/content/f/e/r/ferasferas1/html/scriptslibrary/templates/ja_purity/ja_templatetools.php on line 49
Connect ASP.Net to MySQL database - The Scripts Library Community

Free Programming Tutorials & Source Code

 
  • Increase font size
  • Default font size
  • Decrease font size
Home ASP.Net Connect ASP.Net to MySQL database

Connect ASP.Net to MySQL database

E-mail
(3 votes, average: 4.67 out of 5)

 

MySql is a free open-source database server. Thus, many people would like to use it with in
ASP.Net pages to cut the cost of their projects.

It’s pretty easy to connect ASP.Net pages to MySQL database. First you have to have MySQL
database and the MySQL ODBC Driver.

You can download MySQL:

http://dev.mysql.com/downloads/mysql/5.0.html

 

And the MySQL ODBC Driver here:

http://dev.mysql.com/downloads/connector/odbc/5.1.html

 

Also, you can download the MySQL GUI tools here:

http://dev.mysql.com/downloads/gui-tools/5.0.html

The GUI tools will make it easy to create database, tables, columns, and so on.  Now it’s time
to connect your ASP.NET project to a MySQL Database.

In your asp.net page, import the following name space:

  <%@ Import Namespace="System.Data.ODBC" %>

Create a ODBCDataConnection , and set the connection string to:

 "Driver={MySQL ODBC 5.1 Driver};uid=username;password=pass;Server=servername;
Option=16834;Database=dbname;"

Test your connection. Done!

Now you can use the database classes such as ODBCDataAdapter, ODBCDataReader, to manipulate
your data in your ASP.Net pages

 

Happy coding!