Help with MySQL

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Mar 2007
Posts: 14
Reputation: someoneelse is an unknown quantity at this point 
Solved Threads: 0
someoneelse someoneelse is offline Offline
Newbie Poster

Help with MySQL

 
0
  #1
Apr 5th, 2007

I am trying to connect to a mysql database. ideally, i'd like it dumped into a grid view so i can edit it... no matter how i try it, i get this error-

Compiler Error Message: BC30002: Type 'ODBCConnection' is not defined.
here is the code for this page:

  1. <%@ page language="VB" Debug=true %>
  2. <%@ Import Namespace="System.Data" %>
  3. <%@ Import Namespace="Microsoft.Data.Odbc" %>
  4. <HTML>
  5. <HEAD>
  6. <SCRIPT Language="VBScript" Runat="server">
  7. Sub Page_Load(Source as object, e as EventArgs)
  8. Dim sConnection = "DRIVER={MySQL ODBC 3.51 Driver};" _
  9. & "SERVER=localhost;" _
  10. & "DATABASE=db;" _
  11. & "UID=BrowserName;" _
  12. & "PWD=bfakepass;" _
  13. & "OPTION=3"
  14. '& 1 + 2 + 8 + 32 + 2048 + 16384
  15. Dim oConnection as ODBCConnection = new ODBCConnection(sConnection)
  16. Dim sSQL as String = "SELECT FirstName, LastName FROM addresses"
  17. Dim oDataAdapter as ODBCDataAdapter = New ODBCDataAdapter(sSQL, oConnection)
  18. Dim oDataSet as DataSet = new DataSet()
  19. oDataAdapter.Fill(oDataSet)
  20. oDataGrid.DataSource = oDataSet
  21. oDataGrid.DataBind()
  22. End Sub
  23. </SCRIPT >
  24. </HEAD>
  25. <BODY>
  26. <ASP:DataGrid ID="oDataGrid" Runat="server" />
  27. </BODY>
  28. </HTML>
  29.  
Reply With Quote Quick reply to this message  
Join Date: Nov 2005
Posts: 95
Reputation: ManicCW is an unknown quantity at this point 
Solved Threads: 11
ManicCW's Avatar
ManicCW ManicCW is offline Offline
Junior Poster in Training

Re: Help with MySQL

 
0
  #2
Apr 13th, 2007
Did you import namespace System.Data.Odbc?

Btw. You did not declare sConnection as string.

Dim sConnection As String
Reply With Quote Quick reply to this message  
Reply

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


Thread Tools Search this Thread



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

©2003 - 2009 DaniWeb® LLC