0

:sad:
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:

<%@ page language="VB" Debug=true %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="Microsoft.Data.Odbc" %>
<HTML>
<HEAD>
<SCRIPT Language="VBScript" Runat="server">
Sub Page_Load(Source as object, e as EventArgs)
Dim sConnection = "DRIVER={MySQL ODBC 3.51 Driver};" _ 
& "SERVER=localhost;" _ 
& "DATABASE=db;" _ 
& "UID=BrowserName;" _ 
& "PWD=bfakepass;" _ 
& "OPTION=3" 
'& 1 + 2 + 8 + 32 + 2048 + 16384 
Dim oConnection as ODBCConnection = new ODBCConnection(sConnection)
Dim sSQL as String = "SELECT FirstName, LastName FROM addresses"
Dim oDataAdapter as ODBCDataAdapter = New ODBCDataAdapter(sSQL, oConnection)
Dim oDataSet as DataSet = new DataSet()
oDataAdapter.Fill(oDataSet)
oDataGrid.DataSource = oDataSet
oDataGrid.DataBind()
End Sub
</SCRIPT >
</HEAD>
<BODY>
<ASP:DataGrid ID="oDataGrid" Runat="server" />
</BODY>
</HTML>
2
Contributors
1
Reply
2
Views
10 Years
Discussion Span
Last Post by ManicCW
0

Did you import namespace System.Data.Odbc?

Btw. You did not declare sConnection as string.

Dim sConnection As String

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.