944,216 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Unsolved
  • Views: 1713
  • ASP.NET RSS
Apr 5th, 2007
0

Help with MySQL

Expand Post »

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:

ASP.NET Syntax (Toggle Plain Text)
  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.  
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
someoneelse is offline Offline
14 posts
since Mar 2007
Apr 13th, 2007
0

Re: Help with MySQL

Did you import namespace System.Data.Odbc?

Btw. You did not declare sConnection as string.

Dim sConnection As String
Reputation Points: 12
Solved Threads: 11
Junior Poster in Training
ManicCW is offline Offline
95 posts
since Nov 2005

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:
Previous Thread in ASP.NET Forum Timeline: Run msn messenger on button click in asp.net 2.0
Next Thread in ASP.NET Forum Timeline: Search record from SQLDatabase





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


Follow us on Twitter


© 2011 DaniWeb® LLC