Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ODBC Connection to an Access and Oracle Database in ASP .NET

Status
Not open for further replies.

Loetchie

Programmer
Apr 17, 2003
1
BE
Hi,
I have a problem with my data connection.
I would like to use Odbc to connect to an Access and an Oracle database. This is the reason why I want to use Odbc because with that i can connect to both of my databases without changing my entire code.
I work in ASP .NET (VB).

Here is the code I use:

<%@ Page Language=&quot;VB&quot; Debug=&quot;true&quot; %>
<%@ import Namespace=&quot;System.Data&quot; %>
<%@ import Namespace=&quot;Microsoft.Data.ODBC&quot; %>

<script runat=&quot;server&quot;>
Dim data as New DataSet
Dim str as String = &quot;DRIVER={Microsoft Access Driver (*.mdb);Dbq=data.mdb;&quot;
Dim conn as New OdbcConnection(str)
conn.open()
command = New OdbcDataAdapter (&quot;select username, name, firstname, email &quot; _
& &quot;From User &quot; _
& &quot;Order By username&quot;, conn)
command.Fill(data, &quot;User&quot;)
dgUser.DataSource = PageData.Tables(&quot;User&quot;).DefaultView
dgUser.DataBind
</script>

<html>
<head>
</head>
<body>
<form runat=&quot;server&quot;>
<ASP:DataGrid id=&quot;dgUser&quot; runat=&quot;server&quot; Width=&quot;90%&quot; CellPadding=&quot;3&quot; CellSpacing=&quot;0&quot; AutoGenerateColumns=&quot;False&quot;>
<Columns>
'code to define my colums comes here
</Columns>
</ASP:DataGrid>
<br />
<br />
</form>
</body>
</html>

The problem I have is that when I compile my code to try it out that the computer don't recognize the type OdbcConnection, OdbcCommand.
Normally he should recognize it because I have import the namespace Microsoft.Data.Odbc
And still he don't recognize the types.

If there is anyone who knows the answer to my problem, I would be very grateful to this person!

I would like to thank you now already!!

A Programmer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top