472,371 Members | 1,476 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,371 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 2138
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: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
1
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
0
by: jack2019x | last post by:
hello, Is there code or static lib for hook swapchain present? I wanna hook dxgi swapchain present for dx11 and dx9.

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.