473,395 Members | 1,774 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

*** HELP *** Problems Accessing Simple VB.NET Access Database


I'm having a problem in accessing a Microsoft Access Database in a
VB.NET Web Application. It's so straight forward, I thought I'd walk
you through all the details here:

1) I have a .NET Web Application called "Lesson18b" under
"C:\Inetpub\wwwroot\Lesson18b".

2) I have one Web Form on this Lesson called "Form18b.aspx"

3) In this same Folder under Inetpub I have the Microsoft NorthWinds
Access Database called "FPNWIND.MDB"

4) I add an OleDBConnection called OleDBConnection1 to Form18b.aspx.
I set the "New Connection" Properties to: Provider is "Microsoft
Jet 4.0 OLE DB Provider". Database Name is "FPNWIND.MDB". User
name is "Admin". Blank Password is checked. I test the connection
and it states that the "Test Connection Succeeded". I choose not
to include a password in the connection string.

5) I then add an OleDBCommand called OleDBCommand1 to Form18b.aspx. I
set the connection to OleDBConnection1. For the command text I select
the "..." and when asked, I add table "Customers". I move
"All Columns" to the grid below, producing the SQL "SELECT
Customers.* FROM Customers". When I right click the bottom
grid and choose "Run", it fills the grid with data. So far, so
good.

6) To Form18.aspx I add a text field called "txtResults" and a
command button called "Button1".

7) Double-clicking on "Button1", I add the following lines of
code:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim dr As OleDb.OleDbDataReader
OleDbConnection1.Open()
dr = OleDbCommand1.ExecuteReader
While dr.Read
txtResults.Text = dr.GetValue(0)
End While
End Sub

8) When I build, then run the application, and click on "Button1",
I get the following error:

We can't find http://localhost/Lesson18b/Form18b.aspx
Error - Internal server error

9) If I debug the application, it bombs on the following line in
Button1:

OleDbConnection1.Open()

I'm trying to get the data to display on txtResults. This code works
fine in a regular VB App...but for some reason it will not work on this
Web VB App.

Does anyone have any ideas on why this is happening?

Jul 29 '06 #1
5 2242
This is an easy one :-)
Rights ,,, in the 2005 version you can create a special data subdirectory ,
however in previous versions i would recomend to create a subdirectory
outside the inetpub and grant the rights on this directory for the Asp.net
worker processes
regards

Michel Posseth [MCP]

<sa***********@yahoo.caschreef in bericht
news:11**********************@i3g2000cwc.googlegro ups.com...
>
I'm having a problem in accessing a Microsoft Access Database in a
VB.NET Web Application. It's so straight forward, I thought I'd walk
you through all the details here:

1) I have a .NET Web Application called "Lesson18b" under
"C:\Inetpub\wwwroot\Lesson18b".

2) I have one Web Form on this Lesson called "Form18b.aspx"

3) In this same Folder under Inetpub I have the Microsoft NorthWinds
Access Database called "FPNWIND.MDB"

4) I add an OleDBConnection called OleDBConnection1 to Form18b.aspx.
I set the "New Connection" Properties to: Provider is "Microsoft
Jet 4.0 OLE DB Provider". Database Name is "FPNWIND.MDB". User
name is "Admin". Blank Password is checked. I test the connection
and it states that the "Test Connection Succeeded". I choose not
to include a password in the connection string.

5) I then add an OleDBCommand called OleDBCommand1 to Form18b.aspx. I
set the connection to OleDBConnection1. For the command text I select
the "..." and when asked, I add table "Customers". I move
"All Columns" to the grid below, producing the SQL "SELECT
Customers.* FROM Customers". When I right click the bottom
grid and choose "Run", it fills the grid with data. So far, so
good.

6) To Form18.aspx I add a text field called "txtResults" and a
command button called "Button1".

7) Double-clicking on "Button1", I add the following lines of
code:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim dr As OleDb.OleDbDataReader
OleDbConnection1.Open()
dr = OleDbCommand1.ExecuteReader
While dr.Read
txtResults.Text = dr.GetValue(0)
End While
End Sub

8) When I build, then run the application, and click on "Button1",
I get the following error:

We can't find http://localhost/Lesson18b/Form18b.aspx
Error - Internal server error

9) If I debug the application, it bombs on the following line in
Button1:

OleDbConnection1.Open()

I'm trying to get the data to display on txtResults. This code works
fine in a regular VB App...but for some reason it will not work on this
Web VB App.

Does anyone have any ideas on why this is happening?

Jul 30 '06 #2
Right, I'm using Visual Studio 2003. Ok, I'll put the database in
"C"\Databases" which is out side INETPUB. How do I "grant the rights
on this directory for the Asp.net worker processes" ?

Thanks.
Michel Posseth [MCP] wrote:
This is an easy one :-)
Rights ,,, in the 2005 version you can create a special data subdirectory ,
however in previous versions i would recomend to create a subdirectory
outside the inetpub and grant the rights on this directory for the Asp.net
worker processes
regards

Michel Posseth [MCP]

<sa***********@yahoo.caschreef in bericht
news:11**********************@i3g2000cwc.googlegro ups.com...

I'm having a problem in accessing a Microsoft Access Database in a
VB.NET Web Application. It's so straight forward, I thought I'd walk
you through all the details here:

1) I have a .NET Web Application called "Lesson18b" under
"C:\Inetpub\wwwroot\Lesson18b".

2) I have one Web Form on this Lesson called "Form18b.aspx"

3) In this same Folder under Inetpub I have the Microsoft NorthWinds
Access Database called "FPNWIND.MDB"

4) I add an OleDBConnection called OleDBConnection1 to Form18b.aspx.
I set the "New Connection" Properties to: Provider is "Microsoft
Jet 4.0 OLE DB Provider". Database Name is "FPNWIND.MDB". User
name is "Admin". Blank Password is checked. I test the connection
and it states that the "Test Connection Succeeded". I choose not
to include a password in the connection string.

5) I then add an OleDBCommand called OleDBCommand1 to Form18b.aspx. I
set the connection to OleDBConnection1. For the command text I select
the "..." and when asked, I add table "Customers". I move
"All Columns" to the grid below, producing the SQL "SELECT
Customers.* FROM Customers". When I right click the bottom
grid and choose "Run", it fills the grid with data. So far, so
good.

6) To Form18.aspx I add a text field called "txtResults" and a
command button called "Button1".

7) Double-clicking on "Button1", I add the following lines of
code:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim dr As OleDb.OleDbDataReader
OleDbConnection1.Open()
dr = OleDbCommand1.ExecuteReader
While dr.Read
txtResults.Text = dr.GetValue(0)
End While
End Sub

8) When I build, then run the application, and click on "Button1",
I get the following error:

We can't find http://localhost/Lesson18b/Form18b.aspx
Error - Internal server error

9) If I debug the application, it bombs on the following line in
Button1:

OleDbConnection1.Open()

I'm trying to get the data to display on txtResults. This code works
fine in a regular VB App...but for some reason it will not work on this
Web VB App.

Does anyone have any ideas on why this is happening?
Jul 30 '06 #3
ASP.Net runs under a user account so you can grant it rights as you can with
anny user

as an alternative you can use impersonation

see this for details :
http://support.microsoft.com/kb/317012/

you can grant Write permissions for the ASPNET account. You can grant Write
permissions for an individual file or for directory hierarchies.

Important When you grant Write permissions for an individual file or for
directory hierarchies to the ASPNET account, all ASP.NET Web applications
that are running under the ASPNET account on the server are also able to
write to this file or the directory hierarchies ( however if you created a
specific directory this should not be a problem )


"sa***********@yahoo.ca" wrote:
Right, I'm using Visual Studio 2003. Ok, I'll put the database in
"C"\Databases" which is out side INETPUB. How do I "grant the rights
on this directory for the Asp.net worker processes" ?

Thanks.
Michel Posseth [MCP] wrote:
This is an easy one :-)
Rights ,,, in the 2005 version you can create a special data subdirectory ,
however in previous versions i would recomend to create a subdirectory
outside the inetpub and grant the rights on this directory for the Asp.net
worker processes
regards

Michel Posseth [MCP]

<sa***********@yahoo.caschreef in bericht
news:11**********************@i3g2000cwc.googlegro ups.com...
>
I'm having a problem in accessing a Microsoft Access Database in a
VB.NET Web Application. It's so straight forward, I thought I'd walk
you through all the details here:
>
1) I have a .NET Web Application called "Lesson18b" under
"C:\Inetpub\wwwroot\Lesson18b".
>
2) I have one Web Form on this Lesson called "Form18b.aspx"
>
3) In this same Folder under Inetpub I have the Microsoft NorthWinds
Access Database called "FPNWIND.MDB"
>
4) I add an OleDBConnection called OleDBConnection1 to Form18b.aspx.
I set the "New Connection" Properties to: Provider is "Microsoft
Jet 4.0 OLE DB Provider". Database Name is "FPNWIND.MDB". User
name is "Admin". Blank Password is checked. I test the connection
and it states that the "Test Connection Succeeded". I choose not
to include a password in the connection string.
>
5) I then add an OleDBCommand called OleDBCommand1 to Form18b.aspx. I
set the connection to OleDBConnection1. For the command text I select
the "..." and when asked, I add table "Customers". I move
"All Columns" to the grid below, producing the SQL "SELECT
Customers.* FROM Customers". When I right click the bottom
grid and choose "Run", it fills the grid with data. So far, so
good.
>
6) To Form18.aspx I add a text field called "txtResults" and a
command button called "Button1".
>
7) Double-clicking on "Button1", I add the following lines of
code:
>
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim dr As OleDb.OleDbDataReader
OleDbConnection1.Open()
dr = OleDbCommand1.ExecuteReader
While dr.Read
txtResults.Text = dr.GetValue(0)
End While
End Sub
>
8) When I build, then run the application, and click on "Button1",
I get the following error:
>
We can't find http://localhost/Lesson18b/Form18b.aspx
Error - Internal server error
>
9) If I debug the application, it bombs on the following line in
Button1:
>
OleDbConnection1.Open()
>
I'm trying to get the data to display on txtResults. This code works
fine in a regular VB App...but for some reason it will not work on this
Web VB App.
>
Does anyone have any ideas on why this is happening?
>

Jul 30 '06 #4
I've created a database outside the "C:\InetPub" Account. Now, when I
run the program I get an error on the line:

OleDbConnection1.Open()

It says:

We can't find "http://localhost/DBTest1/frmMain.aspx"
Error - Internal server error

If I comment out this line then it doesn't have any problems finding
the Web Page.

I can't seem to find a way to debug this any further...just the
"Internal Error" business. If I click on the "Run" Option in the
bottom grid on the OleCommand1 Object I do see the data from the
database... The connection seems to be working fine.

How come I'm getting this error?

Thanks
M. Posseth wrote:
ASP.Net runs under a user account so you can grant it rights as you can with
anny user

as an alternative you can use impersonation

see this for details :
http://support.microsoft.com/kb/317012/

you can grant Write permissions for the ASPNET account. You can grant Write
permissions for an individual file or for directory hierarchies.

Important When you grant Write permissions for an individual file or for
directory hierarchies to the ASPNET account, all ASP.NET Web applications
that are running under the ASPNET account on the server are also able to
write to this file or the directory hierarchies ( however if you created a
specific directory this should not be a problem )


"sa***********@yahoo.ca" wrote:
Right, I'm using Visual Studio 2003. Ok, I'll put the database in
"C"\Databases" which is out side INETPUB. How do I "grant the rights
on this directory for the Asp.net worker processes" ?

Thanks.
Michel Posseth [MCP] wrote:
This is an easy one :-)
>
>
Rights ,,, in the 2005 version you can create a special data subdirectory ,
however in previous versions i would recomend to create a subdirectory
outside the inetpub and grant the rights on this directory for the Asp.net
worker processes
>
>
regards
>
Michel Posseth [MCP]
>
>
>
<sa***********@yahoo.caschreef in bericht
news:11**********************@i3g2000cwc.googlegro ups.com...

I'm having a problem in accessing a Microsoft Access Database in a
VB.NET Web Application. It's so straight forward, I thought I'd walk
you through all the details here:

1) I have a .NET Web Application called "Lesson18b" under
"C:\Inetpub\wwwroot\Lesson18b".

2) I have one Web Form on this Lesson called "Form18b.aspx"

3) In this same Folder under Inetpub I have the Microsoft NorthWinds
Access Database called "FPNWIND.MDB"

4) I add an OleDBConnection called OleDBConnection1 to Form18b.aspx.
I set the "New Connection" Properties to: Provider is "Microsoft
Jet 4.0 OLE DB Provider". Database Name is "FPNWIND.MDB". User
name is "Admin". Blank Password is checked. I test the connection
and it states that the "Test Connection Succeeded". I choose not
to include a password in the connection string.

5) I then add an OleDBCommand called OleDBCommand1 to Form18b.aspx. I
set the connection to OleDBConnection1. For the command text I select
the "..." and when asked, I add table "Customers". I move
"All Columns" to the grid below, producing the SQL "SELECT
Customers.* FROM Customers". When I right click the bottom
grid and choose "Run", it fills the grid with data. So far, so
good.

6) To Form18.aspx I add a text field called "txtResults" and a
command button called "Button1".

7) Double-clicking on "Button1", I add the following lines of
code:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim dr As OleDb.OleDbDataReader
OleDbConnection1.Open()
dr = OleDbCommand1.ExecuteReader
While dr.Read
txtResults.Text = dr.GetValue(0)
End While
End Sub

8) When I build, then run the application, and click on "Button1",
I get the following error:

We can't find http://localhost/Lesson18b/Form18b.aspx
Error - Internal server error

9) If I debug the application, it bombs on the following line in
Button1:

OleDbConnection1.Open()

I'm trying to get the data to display on txtResults. This code works
fine in a regular VB App...but for some reason it will not work on this
Web VB App.

Does anyone have any ideas on why this is happening?
Aug 1 '06 #5
I took off "friendly messaging" for the browser, and now have a more
descriptive error for this problem. It says:

The Microsoft Jet database engine cannot open the file
'D:\databases\guest.mdb'. It is already opened exclusively by another
user, or you need permission to view its data.

I have just rebooted the PC, so it cannot be opened exclusively by
another user. When I define the Connection String in the
OleConnection1, I have:

Provider Tab
------------------
a) Microsoft Jet 4.0 OLE DB Provider

Connection Tab
-----------------------
a) I select the database "guestbook.mdb"
b) User name: Admin
c) I click on "Blank password", but not "Allow saving password"

Advanced Tab
--------------------
a) I choose "Share Deny None"

When the wizard is about to close I select: "Include Password"

This didn't work, and I've played around with the settings, but to no
avail. What's wrong?

Thanks
sa***********@yahoo.ca wrote:
I've created a database outside the "C:\InetPub" Account. Now, when I
run the program I get an error on the line:

OleDbConnection1.Open()

It says:

We can't find "http://localhost/DBTest1/frmMain.aspx"
Error - Internal server error

If I comment out this line then it doesn't have any problems finding
the Web Page.

I can't seem to find a way to debug this any further...just the
"Internal Error" business. If I click on the "Run" Option in the
bottom grid on the OleCommand1 Object I do see the data from the
database... The connection seems to be working fine.

How come I'm getting this error?

Thanks
M. Posseth wrote:
ASP.Net runs under a user account so you can grant it rights as you can with
anny user

as an alternative you can use impersonation

see this for details :
http://support.microsoft.com/kb/317012/

you can grant Write permissions for the ASPNET account. You can grant Write
permissions for an individual file or for directory hierarchies.

Important When you grant Write permissions for an individual file or for
directory hierarchies to the ASPNET account, all ASP.NET Web applications
that are running under the ASPNET account on the server are also able to
write to this file or the directory hierarchies ( however if you created a
specific directory this should not be a problem )


"sa***********@yahoo.ca" wrote:
Right, I'm using Visual Studio 2003. Ok, I'll put the database in
"C"\Databases" which is out side INETPUB. How do I "grant the rights
on this directory for the Asp.net worker processes" ?
>
Thanks.
>
>
Michel Posseth [MCP] wrote:
This is an easy one :-)


Rights ,,, in the 2005 version you can create a special data subdirectory ,
however in previous versions i would recomend to create a subdirectory
outside the inetpub and grant the rights on this directory for the Asp.net
worker processes


regards

Michel Posseth [MCP]



<sa***********@yahoo.caschreef in bericht
news:11**********************@i3g2000cwc.googlegro ups.com...
>
I'm having a problem in accessing a Microsoft Access Database in a
VB.NET Web Application. It's so straight forward, I thought I'd walk
you through all the details here:
>
1) I have a .NET Web Application called "Lesson18b" under
"C:\Inetpub\wwwroot\Lesson18b".
>
2) I have one Web Form on this Lesson called "Form18b.aspx"
>
3) In this same Folder under Inetpub I have the Microsoft NorthWinds
Access Database called "FPNWIND.MDB"
>
4) I add an OleDBConnection called OleDBConnection1 to Form18b.aspx.
I set the "New Connection" Properties to: Provider is "Microsoft
Jet 4.0 OLE DB Provider". Database Name is "FPNWIND.MDB". User
name is "Admin". Blank Password is checked. I test the connection
and it states that the "Test Connection Succeeded". I choose not
to include a password in the connection string.
>
5) I then add an OleDBCommand called OleDBCommand1 to Form18b.aspx. I
set the connection to OleDBConnection1. For the command text I select
the "..." and when asked, I add table "Customers". I move
"All Columns" to the grid below, producing the SQL "SELECT
Customers.* FROM Customers". When I right click the bottom
grid and choose "Run", it fills the grid with data. So far, so
good.
>
6) To Form18.aspx I add a text field called "txtResults" and a
command button called "Button1".
>
7) Double-clicking on "Button1", I add the following lines of
code:
>
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim dr As OleDb.OleDbDataReader
OleDbConnection1.Open()
dr = OleDbCommand1.ExecuteReader
While dr.Read
txtResults.Text = dr.GetValue(0)
End While
End Sub
>
8) When I build, then run the application, and click on "Button1",
I get the following error:
>
We can't find http://localhost/Lesson18b/Form18b.aspx
Error - Internal server error
>
9) If I debug the application, it bombs on the following line in
Button1:
>
OleDbConnection1.Open()
>
I'm trying to get the data to display on txtResults. This code works
fine in a regular VB App...but for some reason it will not work on this
Web VB App.
>
Does anyone have any ideas on why this is happening?
>
>
>
Aug 1 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jon Dellaria | last post by:
I have been using MySql as the database using JSP's and JavaBeans but recently I have wanted to start using the database connection pooling mechanism built into TomCat. I think I am having a...
1
by: Brad Pears | last post by:
Our graphic designer is developing our new company website. We have switched providers and currently she is working on the new website which currently ressides on the new providers server as they...
3
by: Scott Castillo | last post by:
Is it possible to access an SQL Server database from a Javascript client? I know you can transfer variables from middleware to Javascript client, but was wondering if you can directly access...
1
by: James Bird | last post by:
Hello In order to perform a hetrogeneous join (I think that's what they're called) between MySQL and another database, I've created an Access database containing linked tables from each...
2
by: DanB | last post by:
I am using VB DotNet Std Edition and am writing a web application that needs to read and write to an password protected database. The mdb files reside in a folder (fpdb) under the localhost...
4
by: James | last post by:
I have a VB windows forms application that accesses a Microsoft Access database that has been secured using user-level security. The application is being deployed using No-Touch deployment. The...
1
by: James | last post by:
I have a VB windows forms application that accesses a Microsoft Access database that has been secured using user-level security. The application is being deployed using No-Touch deployment. The...
4
by: Nijazi Halimaji | last post by:
Hi newsgroup I have some problems with my service which is using ODBC-Connections. My service is executed as a local system (I tried already every other account type, even the domain-admin) ...
4
by: ThePhenix | last post by:
Hi everybody, I have recently been doing a conversion for my boss for a access 2000 database (both front and backend) to a MSSQL backend. I finished the conversion today (as quite a lot of the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.