
Connecting to Database using MySQL 4.1.12 /VB.Net
I am trying to use the VB.Net code below to connect to MySQL database in phpMyAdmin 2.6.4-pl3, but when I view it, it shows nothing.
<%@ Import Namespace="System.Data.OleDB" %>
<%@ Import Namespace="System.Data.ODBC" %>
<html>
<head>
<title>Product List</title>
<script runat="server" language="VB">
Sub Page_Load()
Dim objConn as OleDBConnection
Dim objCmd as OleDBCommand
Dim objRdr as OleDBDataReader
objConn = New OleDbConnection( _
"Provider=MySQLProv;Data Source=products;DB=dbname;USER=myuserid;PASSWORD=mypassword;PORT=3306");
objCmd=New OleDbCommand("SELECT * FROM Products", objConn)
objConn.Open()
objRdr = objCmd.ExecuteReader()
rpcProductList.DataSource = objRdr
rpcProductList.DataBind()
objRdr.Close()
objConn.Close()
End Sub
</script>
</head>
<body>
<form runat="server">
<table width="100%" border="0" cellspacing="0" cellpadding"10">
<tr>
<td valign="top" width="160">
...
</td>
<td valign="top">
<h1>Unique Oils Product List</h1>
<asp:Repeater id="rpcProductList" runat="server">
<ItemTemplate>
<p>SKU: <strong>
<%# Container.DataItem("SKU") %></strong>
Product Name: <strong>
<%# Container.DataItem("ProductName") %></strong>
Manufacturer Name: <strong>
<%# Container.DataItem("MfgName") %></strong></p>
</ItemTemplate>
</asp:Repeater>
</td>
</tr>
</table>
</form>
</body>