Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
|
ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application .
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ADO.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 3rd, 2005, 11:41 AM
Registered User
 
Join Date: Nov 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help!!! Cannot Update, Delete from Access database

Hello,
I am working on my senior project which is an Ecommerce website. The Ecommerce website runs fine in my home

computer. But when I try to work on it in our campus computers, I get this weired problem.
I can login and see the pages displayed well, but when I try to Signout or add some products to the cart, I get

errors saying that the Query cannot be executed.
There seems to be a problem whenever I try to Update, Add, or Delete using SQL statements in my access database.I have full permissions because I created the database. The problem reads, that

the query cannot be executed.
Why does this happen. I tried to talk to the administrator and he does not have a clue what is going on.
I feel that I am doing something wrong in the web config file.
Can you please help. I had a similar problem at my home and I had to change the Machine.Config file in Asp.Net directory and change the settings to System to be able to update the database.
Please email me at [email protected] or reply to this question in this forum
Thanks

 
Old November 3rd, 2005, 12:45 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Your personal account may have created the database, but at run-time a different account is used. By default, ASP.NET runs under the special ASPNET or Network Service account (depending on your version of Windows).

That account needs permissions to the database.

Check out these FAQs that deal with this subject:

http://Imar.Spaanjaars.Com/QuickDocId.aspx?QUICKDOC=290
http://Imar.Spaanjaars.Com/QuickDocID.aspx?QUICKDOC=287

If these FAQs don't help, can you post the error message you get?

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old November 3rd, 2005, 01:48 PM
Registered User
 
Join Date: Nov 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hey man,
Thanx for the reply. This did not help. I am just a student and I dont have permissions to change the IIS settings. The articles used Win Server 2003, but this campus uses Win XP server computers. I cant change those settings. Is there any other way to allow to write to databases. Can U please explain in a little detail because I have looked all over the net for the solution. I fixed it in my computer but cannot in campus computer.

This is how the error looks like:

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException: Could not delete from specified tables.

Source Error:


Line 24: ("DELETE from tblOrders WHERE UserName ='"& name &"'", myConnection)
Line 25: myConnection.Open()
Line 26: myCommand1.ExecuteNonQuery ()
Line 27: myConnection.Close
Line 28: dim myCommand2 as new OleDbCommand _


Source File: D:\MC Web Presence\Computer Science\pacharya\seniorecomm1\SignOut.aspx Line: 26

Stack Trace:


[OleDbException (0x80004005): Could not delete from specified tables.]
   System.Data.OleDb.OleDbCommand.ExecuteCommandTextE rrorHandling(Int32 hr) +41
   System.Data.OleDb.OleDbCommand.ExecuteCommandTextF orSingleResult(tagDBPARAMS dbParams, Object& executeResult) +174
   System.Data.OleDb.OleDbCommand.ExecuteCommandText( Object& executeResult) +92
   System.Data.OleDb.OleDbCommand.ExecuteCommand(Comm andBehavior behavior, Object& executeResult) +65
   System.Data.OleDb.OleDbCommand.ExecuteReaderIntern al(CommandBehavior behavior, String method) +112
   System.Data.OleDb.OleDbCommand.ExecuteNonQuery() +66
   ASP.SignOut_aspx.Page_Load(Object Sender, EventArgs e) in D:\MC Web Presence\Computer Science\pacharya\seniorecomm1\SignOut.aspx:26
   System.Web.UI.Control.OnLoad(EventArgs e) +67
   System.Web.UI.Control.LoadRecursive() +35
   System.Web.UI.Page.ProcessRequestMain() +750

 Can U please help.


 
Old November 3rd, 2005, 01:54 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

The concepts for Windows Server 2003 and XP are pretty much the same.

The 80004005 number in the error message seems to indicate a security problem. How does your connection string look like? Are you using Integrated Security or SQL Authentication??

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old November 3rd, 2005, 05:21 PM
Registered User
 
Join Date: Nov 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hey,
I use Forms Authentication. Where my project is located is a web server.
I have been given space and password to access the server.
It is integrated security. Iuse SQL statements to try to add and modify the records in the access database.
Any ideas whats wrong in it.
Thanks

 
Old November 3rd, 2005, 05:35 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

If you're using Integrated Security to access SQL Server, your DBA or Server Admin should add the required account (e.g. ASPNET or Network Service) to the database. Do you have Integrated Security=true or something similar in your connection string?

Are you building a public website? That is, can people on the internet access it? If not, and this is for internal use only, you could enable impersonation on the website. With impersonation, the website and the web server process runs as you, so you have permission to access the database. However, this only works in a controlled environment with known users (e.g. not random Internet users).

So, contact your DBA and tell him to grant the ASP.NET account access to the database.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Man Next Door by Massive Attack (Track 7 from the album: Mezzanine) What's This?
 
Old November 3rd, 2005, 05:56 PM
Registered User
 
Join Date: Nov 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hey,
I am not using integrated security and I want it to be able to be used over the internet. I also have not used impersonation. I am not using sql server as well, it is an access database.
I want it to be available over the internet.
How can I be able to achieve this.
Can U explain a little bit more bcoz I am not an expert in ASP.net. I am using the wrox book on ASP.Net
Help
Thanks

 
Old November 3rd, 2005, 06:11 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Right, I completely overlooked that. You could have taken the confusion away by posting your connection string 2 posts ago ;)

Anyway, in that case, my FAQs *do* apply. That you cannot carry out the actions is a different story, but either way, the ASPNET or Network Service account needs write permissions to the folder that holds the database.

In addition to those FAQs, you need to look at this one:

http://imar.spaanjaars.com/QuickDocId.aspx?QUICKDOC=263

It explains the steps your system administrator must carry out to enable the webserver to write to the database.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: What Your Soul Sings by Massive Attack (Track 2 from the album: 100th Window) What's This?





Similar Threads
Thread Thread Starter Forum Replies Last Post
Add/Update/Delete Database records MANUALLY jn148 BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 December 14th, 2008 10:18 AM
!!HELP! trying to update an Access database brawny4 VB Databases Basics 4 April 24th, 2007 02:07 PM
How to insert,delete,update datagrids to MS Access maximus101 VB Databases Basics 0 May 8th, 2006 03:03 PM
Access database won't update? jula Access ASP 8 September 26th, 2004 05:46 PM
Database update access inershado Access ASP 1 September 23rd, 2003 11:26 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.