User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the VB.NET section within the Software Development category of DaniWeb, a massive community of 402,862 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,021 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our VB.NET advertiser: Programming Forums
Views: 7009 | Replies: 2
Reply
Join Date: Aug 2004
Posts: 22
Reputation: ecashwell is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 0
ecashwell ecashwell is offline Offline
Newbie Poster

MySQL - ASP.NET - Issues....

  #1  
Aug 14th, 2004
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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Feb 2002
Location: New York
Posts: 862
Reputation: Tekmaven is a glorious beacon of light Tekmaven is a glorious beacon of light Tekmaven is a glorious beacon of light Tekmaven is a glorious beacon of light Tekmaven is a glorious beacon of light 
Rep Power: 12
Solved Threads: 14
Moderator
Tekmaven's Avatar
Tekmaven Tekmaven is offline Offline
The C# Man, Myth, Legend

Re: MySQL - ASP.NET - Issues....

  #2  
Aug 14th, 2004
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?
-Ryan Hoffman

ASP.NET Specialist / Webmaster, Extended64.com.
Please do not email or PM me with support questions. Please direct them to the forums instead.
Reply With Quote  
Join Date: Aug 2004
Posts: 22
Reputation: ecashwell is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 0
ecashwell ecashwell is offline Offline
Newbie Poster

Re: MySQL - ASP.NET - Issues....

  #3  
Aug 14th, 2004
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
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb VB.NET Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the VB.NET Forum

All times are GMT -4. The time now is 1:31 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC