-
ASP.NET (
http://www.daniweb.com/forums/forum18.html)
| someoneelse | Apr 5th, 2007 1:25 pm | |
| Help with MySQL :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> |
| ManicCW | Apr 13th, 2007 3:43 am | |
| Re: Help with MySQL Did you import namespace System.Data.Odbc?
Btw. You did not declare sConnection as string.
Dim sConnection As String |
| All times are GMT -4. The time now is 3:04 pm. | |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC