Click here to Skip to main content
15,886,199 members
Articles / Database Development / MySQL
Article

Connecting ASP.NET and MySQL

Rate me:
Please Sign up or sign in to vote.
1.86/5 (4 votes)
30 Jan 2007 24.1K   19   1
Connecting ASP.NET and MySQL

Introduction

This article demonstrates the connection between between ASP.NET and MySQL.

Code

Imports System.Data
Imports System.Data.Odbc


Partial Class connstring
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

Dim ConnStr As String = "Server=serverip;Provider=MySQLProv;Driver={MySQL ODBC 3.51 Driver};Database=databasename;uid=username;pwd=password"
Dim conn As New Odbc.OdbcConnection(ConnStr)
Dim olecmd As New Odbc.OdbcCommand("select * from Activity", conn)
Dim reader As Odbc.OdbcDataReader
conn.Open()
reader = olecmd.ExecuteReader
reader.Read()
While reader.Read
Response.Write(reader("Name") & "<br>")
End While


End Sub
End Class

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
India India
Currently working as Web Programmer in

Vanilla Networks,Technopark,Trivandrum

Comments and Discussions

 
GeneralConnector/Net Pin
Stanislav Panasik30-Jan-07 3:48
Stanislav Panasik30-Jan-07 3:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.