954,577 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

asp.net with mysql

hi,
im doing a project on 'courier management systems' . i am using asp.net as the application and mysql as the database. im not clear on how to integrate mysql with asp.net... i would appreaciate if some description plus some examples are posted on...thank you

chriscross86
Junior Poster in Training
54 posts since Feb 2009
Reputation Points: 10
Solved Threads: 0
 

. Make sure you have installed the .Net Framework on your server

. Download the ODBC .Net data provider and install it on your server. You can
find the download here:
http://www.microsoft.com/downloads/release.asp?ReleaseID=35715

. Make sure that Microsoft.data.odbc.dll file is located in the following folder
on your server C:\Program Files\Microsoft.NET\Odbc.Net\.

. Install Microsoft Data Access Components (MDAC) 2.6 or later. MDAC 2.8 is
recommended. You can download it here: http://msdn.microsoft.com/data/

. Install MySQL Server.

. install MySQL ODBC Driver-MyODBC 3.51. You can download it here:
http://www.mysql.com/downloads/api-myodbc-3.51.html

Here is the actual code connection to the MySQL database and retrieving and
displaying all the records from Table1 table in your database.

<%@ Page CompilerOptions='/R:"C:\Program Files\Microsoft.NET\Odbc.Net\Microsoft.data.odbc.dll"'%>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="Microsoft.Data.Odbc" %>
<HTML>
<HEAD>
<SCRIPT Language="VB" Runat="server">
Sub Page_Load(Source as object, e as EventArgs)
Dim sConString As String = "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=localhost;
DATABASE=Your_Mysql_DB; UID=mysql_username; PASSWORD=mysql_password; OPTION=3"
Dim oConnection as ODBCConnection = new ODBCConnection(sConString)
Dim sSQL as String = "SELECT * FROM Table1"
Dim oDataAdapter as ODBCDataAdapter = New ODBCDataAdapter(sSQL, oConnection)
Dim oDataSet as DataSet = new DataSet()
oDataAdapter.Fill(oDataSet)
oDataGrid.DataSource = oDataSet
oDataGrid.DataBind()
End Sub
</SCRIPT >
</HEAD>
<BODY>
<ASP:DataGrid ID="oDataGrid" Runat="server" />
</BODY>
</HTML>


After you have tested your solution on your development workstation, you need
to find a web hosting company offering ASP.NET hosting and supporting MySQL
database, in order to deploy your web application and make it available on
Internet.

freshfitz
Posting Pro in Training
436 posts since Sep 2008
Reputation Points: 12
Solved Threads: 36
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You