By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,830 Members | 1,758 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,830 IT Pros & Developers. It's quick & easy.

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

P: n/a

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
Share this Question
Share on Google+
5 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.