I'm trying to get started in ASP.NET, but I just don't understand the errors being returned to me. I'm trying to connect to my MySQL database. I have followed several examples from books and the internet with no success. Could someone look at my code and see if I'm screwing something up?

<%@ Import Namespace="System.Data.OleDB" %>
<%@ Import Namespace="System.Data" %>
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="default_page.aspx.vb" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
	<HEAD>
		<%
			'Put user code to initialize the page here
			Dim dr As System.Data.OleDb.OleDbDataReader
			Dim cn As System.Data.OleDb.OleDbConnection
			Dim cmd As System.Data.OleDb.OleDbCommand
			Dim cs As String
			Dim SQL As String

			cs = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
				"DRIVER={MySQL ODBC 3.51 Driver};" & _
				"SERVER=cashwell.no-ip.info;" & _
				"DATABASE=Saphyre;" & _
				"UID=WebTest;" & _
				"Jet OLEDBatabase PASSWORD=asp-net;" & _
				"OPTION=16427"
			cn = New OleDbConnection(cs)
			cn.Open()

			SQL = "SELECT name FROM tbl_hosp;"
			cmd = New OleDbCommand(SQL)
			dr = cmd.ExecuteReader(CommandBehavior.CloseConnection)
		%>
		<meta content="Microsoft Visual Studio.NET 7.0" name="GENERATOR">
		<meta content="Visual Basic 7.0" name="CODE_LANGUAGE">
		<meta content="JavaScript" name="vs_defaultClientScript">
		<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
		<meta content="VisualStudio.HTML" name="ProgId">
		<meta content="Microsoft Visual Studio.NET 7.0" name="Originator">
	</HEAD>
	<body MS_POSITIONING="GridLayout">			
		<%	
		Response.Write(dr.GetString(0))
		%>
	</body>
</HTML>

Also, how do you use the ****.vb file? I'm using VS.NET as my editor and if you hit F7 you can go to the ****.vb file, but if I place code in the Page_Load event it never runs..... ????

Any clues?????

Thanks in advance
- Eric

Try changing this line: cmd = New OleDbCommand(SQL) to this:

cmd = New OleDbCommand(SQL,cn)

Also, your Page_Load event probably isn't working, because it's not wired up. Is there a 'Handles Page.Load' at the end of the declaration line?

I placed the connection object in the parameter as you instructed. I'm now getting a new error, "Could not find installable ISAM."

You can see the error at this address: http://www.derivetech.us/default_page.aspx

Any thoughts?

****.vb:
I did a search and could not find

Handles Page.Load

anywhere.

- Eric

This article has been dead for over six months. Start a new discussion instead.