ASP.NET and Microsoft Access issues
Posted: Mon May 22, 2006 2:09 pm
I wasn't sure if this would go under the Misc. section or database section ..... so here it is
I'm currently running Visual Studio 2005 on a Windows XP machine. I'm basically just trying to run a simple script in VB.NET that will allow me to connect to an Access database and display one column on the browser page. The column i'm trying to display is called "email". The code is correct, I'm almost positive about that. It also points to the right directories etc etc. It builds fine. And i'm able to run the code with no errors. Yet all i seem to be able to yield is a blank browser page.
I've tried in both firefox and internet explorer. I'm extremely baffled up to this point. It's probably something very stupid that i'm missing
. Here's the code I have in case anyone has any ideas.
--Begin my code --
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<%@ Import Namespace="System.Data.OleDb" %>
<html>
<head>
<title>Connecting to a Database using VB</title>
<script runat="server" language="VB">
Sub Page_Load()
Dim objConn As OleDbConnection
Dim objCmd As OleDbCommand
Dim objRdr As OleDbDataReader
objConn = New OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;" & _
"Data Source=C:\Inetpub\wwwroot\nestemplate\Database\test.mdb")
objCmd = New OleDbCommand("SELECT * FROM account", objConn)
objConn.Open()
objRdr = objCmd.ExecuteReader()
While objRdr.Read()
Response.Write(objRdr.Item("email"))
End While
objRdr.Close()
objConn.Close()
End Sub
</script>
</head>
<body>
</body>
</html>
--End My Code--
The .mdb file is located in the exact directory as everything else. Any help would be greatly appreciated.

I'm currently running Visual Studio 2005 on a Windows XP machine. I'm basically just trying to run a simple script in VB.NET that will allow me to connect to an Access database and display one column on the browser page. The column i'm trying to display is called "email". The code is correct, I'm almost positive about that. It also points to the right directories etc etc. It builds fine. And i'm able to run the code with no errors. Yet all i seem to be able to yield is a blank browser page.
I've tried in both firefox and internet explorer. I'm extremely baffled up to this point. It's probably something very stupid that i'm missing
. Here's the code I have in case anyone has any ideas.
--Begin my code --
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<%@ Import Namespace="System.Data.OleDb" %>
<html>
<head>
<title>Connecting to a Database using VB</title>
<script runat="server" language="VB">
Sub Page_Load()
Dim objConn As OleDbConnection
Dim objCmd As OleDbCommand
Dim objRdr As OleDbDataReader
objConn = New OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;" & _
"Data Source=C:\Inetpub\wwwroot\nestemplate\Database\test.mdb")
objCmd = New OleDbCommand("SELECT * FROM account", objConn)
objConn.Open()
objRdr = objCmd.ExecuteReader()
While objRdr.Read()
Response.Write(objRdr.Item("email"))
End While
objRdr.Close()
objConn.Close()
End Sub
</script>
</head>
<body>
</body>
</html>
--End My Code--
The .mdb file is located in the exact directory as everything else. Any help would be greatly appreciated.