MySQL - ASP.NET - Issues....

Please support our VB.NET advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
Reply

Join Date: Aug 2004
Posts: 22
Reputation: ecashwell is an unknown quantity at this point 
Solved Threads: 0
ecashwell ecashwell is offline Offline
Newbie Poster

MySQL - ASP.NET - Issues....

 
0
  #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?
  1. <%@ Import Namespace="System.Data.OleDB" %>
  2. <%@ Import Namespace="System.Data" %>
  3. <%@ Page Language="vb" AutoEventWireup="false" Codebehind="default_page.aspx.vb" %>
  4. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  5. <HTML>
  6. <HEAD>
  7. <%
  8. 'Put user code to initialize the page here
  9. Dim dr As System.Data.OleDb.OleDbDataReader
  10. Dim cn As System.Data.OleDb.OleDbConnection
  11. Dim cmd As System.Data.OleDb.OleDbCommand
  12. Dim cs As String
  13. Dim SQL As String
  14.  
  15. cs = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
  16. "DRIVER={MySQL ODBC 3.51 Driver};" & _
  17. "SERVER=cashwell.no-ip.info;" & _
  18. "DATABASE=Saphyre;" & _
  19. "UID=WebTest;" & _
  20. "Jet OLEDBatabase PASSWORD=asp-net;" & _
  21. "OPTION=16427"
  22. cn = New OleDbConnection(cs)
  23. cn.Open()
  24.  
  25. SQL = "SELECT name FROM tbl_hosp;"
  26. cmd = New OleDbCommand(SQL)
  27. dr = cmd.ExecuteReader(CommandBehavior.CloseConnection)
  28. %>
  29. <meta content="Microsoft Visual Studio.NET 7.0" name="GENERATOR">
  30. <meta content="Visual Basic 7.0" name="CODE_LANGUAGE">
  31. <meta content="JavaScript" name="vs_defaultClientScript">
  32. <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
  33. <meta content="VisualStudio.HTML" name="ProgId">
  34. <meta content="Microsoft Visual Studio.NET 7.0" name="Originator">
  35. </HEAD>
  36. <body MS_POSITIONING="GridLayout">
  37. <%
  38. Response.Write(dr.GetString(0))
  39. %>
  40. </body>
  41. </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
Reply With Quote Quick reply to this message  
Join Date: Feb 2002
Posts: 898
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 
Solved Threads: 28
Moderator
Tekmaven's Avatar
Tekmaven Tekmaven is offline Offline
The C# Man, Myth, Legend

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

 
0
  #2
Aug 14th, 2004
Try changing this line: cmd = New OleDbCommand(SQL) to this:
  1. 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

.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 Quick reply to this message  
Join Date: Aug 2004
Posts: 22
Reputation: ecashwell is an unknown quantity at this point 
Solved Threads: 0
ecashwell ecashwell is offline Offline
Newbie Poster

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

 
0
  #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 Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the VB.NET Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC