J
Jim
Hello everyone,
This is my first time posting to a Usenet group, so please excuse any
Netiquette errors I may have in my post. I have used ASP.NET before
using C#, but never VB, so I'm trying to practice using VB. I have a
very simple page that I would like to connect to an Access DB and
output some fields. Here's the code that I have:
<%@ Page Language="VB" Debug="true" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<%
Dim strconn As String = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA
SOURCE=" + Server.MapPath("~/test.mdb") & ";"
Dim sql As String = "SELECT * FROM Employees"
Dim connection As New OleDbConnection(strconn)
Dim ds As DataSet = New DataSet()
Dim da As New OleDbDataAdapter(sql, connection)
da.Fill(ds, "T1")
DataGrid1.DataSource = ds
DataGrid1.DataBind()
%>
<html>
<head>
<title>test</title>
</head>
<body>
<%
Dim dc As DataColumn
Dim dr As DataRow
For Each dr In ds.Tables(0).Rows
For Each dc In ds.Tables(0).Columns
Response.Write(dr(dc.ColumnName).ToString())
Next
Next
%>
</body>
</html>
When I go to this page in my web browser, I get 'Server Error in '/
DotNet' Application, followed by 'Runtime Error'. The Description
says 'An application error occurred on the server.' There is more to
the error, but I'm assuming this is a generic error that you guys (and
gals) have seen before. Any suggestions?
This is my first time posting to a Usenet group, so please excuse any
Netiquette errors I may have in my post. I have used ASP.NET before
using C#, but never VB, so I'm trying to practice using VB. I have a
very simple page that I would like to connect to an Access DB and
output some fields. Here's the code that I have:
<%@ Page Language="VB" Debug="true" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<%
Dim strconn As String = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA
SOURCE=" + Server.MapPath("~/test.mdb") & ";"
Dim sql As String = "SELECT * FROM Employees"
Dim connection As New OleDbConnection(strconn)
Dim ds As DataSet = New DataSet()
Dim da As New OleDbDataAdapter(sql, connection)
da.Fill(ds, "T1")
DataGrid1.DataSource = ds
DataGrid1.DataBind()
%>
<html>
<head>
<title>test</title>
</head>
<body>
<%
Dim dc As DataColumn
Dim dr As DataRow
For Each dr In ds.Tables(0).Rows
For Each dc In ds.Tables(0).Columns
Response.Write(dr(dc.ColumnName).ToString())
Next
Next
%>
</body>
</html>
When I go to this page in my web browser, I get 'Server Error in '/
DotNet' Application, followed by 'Runtime Error'. The Description
says 'An application error occurred on the server.' There is more to
the error, but I'm assuming this is a generic error that you guys (and
gals) have seen before. Any suggestions?