943,918 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 8990
  • VB.NET RSS
Aug 14th, 2004
0

MySQL - ASP.NET - Issues....

Expand Post »
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?
VB.NET Syntax (Toggle Plain Text)
  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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ecashwell is offline Offline
22 posts
since Aug 2004
Aug 14th, 2004
0

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

Try changing this line: cmd = New OleDbCommand(SQL) to this:
VB.NET Syntax (Toggle Plain Text)
  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?
Moderator
Reputation Points: 322
Solved Threads: 28
The C# Man, Myth, Legend
Tekmaven is offline Offline
914 posts
since Feb 2002
Aug 14th, 2004
0

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

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
Quote ...
Handles Page.Load
anywhere.

- Eric
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ecashwell is offline Offline
22 posts
since Aug 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC