471,089 Members | 1,123 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,089 software developers and data experts.

Runtime error when trying to connect to an Access DB

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?

Jan 30 '07 #1
2 1422
Make sure you set permissions on the file AND the folder.

the folder: because it needs to create an .ldb file.

...

Other than that, you need to specify an exact message.

Turn off "friendly http errors" on your IE options. (something like that)

Remember "who are you" in a web environment. asp.net doesnt run under
IUSR_, it runs under ASPNET

"Jim" <Ja**********@gmail.comwrote in message
news:11*********************@v45g2000cwv.googlegro ups.com...
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?

Jan 30 '07 #2
Jim
Thanks for the reply. I have a feeling that it has something to do
with the folder permissions. I do have write access to this
directory, but maybe connecting to a DB is under a different setting?
I'm not really savvy with server permissions, but I'll check into it.
Thanks again.

Oh, I'm doing this at work, so that's why I need to check into it. I
just realized that I probably sounded a little strange saying I needed
to check into it if it was on my own computer.
On Jan 30, 4:21 pm, "sloan" <s...@ipass.netwrote:
Make sure you set permissions on the file AND the folder.

the folder: because it needs to create an .ldb file.

..

Other than that, you need to specify an exact message.

Turn off "friendly http errors" on your IE options. (something like that)

Remember "who are you" in a web environment. asp.net doesnt run under
IUSR_, it runs under ASPNET

"Jim" <James.T.H...@gmail.comwrote in message

news:11*********************@v45g2000cwv.googlegro ups.com...
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?- Hide quoted text -

- Show quoted text -

Jan 31 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

22 posts views Thread by James Kupernik | last post: by
2 posts views Thread by Paul | last post: by
2 posts views Thread by arsisthesis | last post: by
1 post views Thread by TeeCo | last post: by
1 post views Thread by rickcross | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.