Click here to Skip to main content
Click here to Skip to main content

Connecting ASP.NET and MySQL

By , 30 Jan 2007
Rate this:
Please Sign up or sign in to vote.

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

About the Author

Mathew G Sujith
Web Developer
India India
Currently working as Web Programmer in
 
Vanilla Networks,Technopark,Trivandrum

Comments and Discussions

 
GeneralConnector/Net PinmemberStanislav Panasik30-Jan-07 3:48 

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

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

| Advertise | Privacy | Mobile
Web03 | 2.8.140415.2 | Last Updated 30 Jan 2007
Article Copyright 2007 by Mathew G Sujith
Everything else Copyright © CodeProject, 1999-2014
Terms of Use
Layout: fixed | fluid