Sub Page_Load(sender As Object, e As EventArgs)
Dim strConnString As String
strConnString = "Driver={MySQL ODBC 5.1 Driver}; SERVER=localhost;UID=root;PWD=root;database=mydatabase;option=16384;"
objConn = New OdbcConnection(strConnString)
objConn.Open()
IF Not Page.IsPostBack() Then
BindData()
End IF
End Sub
Sub BindData()
strSQL = "SELECT * FROM customer"
Dim dtReader As OdbcDataReader
objCmd = New OdbcCommand(strSQL, objConn)
dtReader = objCmd.ExecuteReader()
'*** BindData to GridView ***'
myGridView.DataSource = dtReader
myGridView.DataBind()
dtReader.Close()
dtReader = Nothing
End Sub