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="VB" Debug="true" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="Microsoft.Data.ODBC" %>
<script runat="server">
Dim data as New DataSet
Dim str as String = "DRIVER={Microsoft Access Driver (*.mdb);Dbq=data.mdb;"
Dim conn as New OdbcConnection(str)
conn.open()
command = New OdbcDataAdapter ("select username, name, firstname, email " _
& "From User " _
& "Order By username", conn)
command.Fill(data, "User"
dgUser.DataSource = PageData.Tables("User".DefaultView
dgUser.DataBind
</script>
<html>
<head>
</head>
<body>
<form runat="server">
<ASPataGrid id="dgUser" runat="server" Width="90%" CellPadding="3" CellSpacing="0" AutoGenerateColumns="False">
<Columns>
'code to define my colums comes here
</Columns>
</ASPataGrid>
<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
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="VB" Debug="true" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="Microsoft.Data.ODBC" %>
<script runat="server">
Dim data as New DataSet
Dim str as String = "DRIVER={Microsoft Access Driver (*.mdb);Dbq=data.mdb;"
Dim conn as New OdbcConnection(str)
conn.open()
command = New OdbcDataAdapter ("select username, name, firstname, email " _
& "From User " _
& "Order By username", conn)
command.Fill(data, "User"
dgUser.DataSource = PageData.Tables("User".DefaultView
dgUser.DataBind
</script>
<html>
<head>
</head>
<body>
<form runat="server">
<ASPataGrid id="dgUser" runat="server" Width="90%" CellPadding="3" CellSpacing="0" AutoGenerateColumns="False">
<Columns>
'code to define my colums comes here
</Columns>
</ASPataGrid>
<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