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

Deleting rows in Access database table

P: n/a
I get an error message when deleting rows from a table in Access database.

My understanding is that the error message relates to the sharing of the
Inetpub and the wwwroot directory.

While I have set the directories to "Share" in the properties window, it
still does not allow row removal.

I'm running Microsoft Windows XP, Professional, Version 2002, Service Pack 1.

The code is as follows and the error message is after it.
***************** Start Code ********************
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.Oledb" %>

Sub Page_Load(Sender as object, e as EventArgs)
if not isPostBack then

Dim Con As OleDbConnection = New OleDbConnection
Dim DA As OleDbDataAdapter = New OleDbDataAdapter
Dim ConnectString, delCmd, x as String

x = Server.Mappath("\ASPClass\FinalProj\DB.mdb")

ConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & x

Con.ConnectionString = ConnectString
delCmd = "DELETE * FROM ORDERS"

DA.DeleteCommand = New OleDbCommand(delCmd, Con)
Con.Open
DA.DeleteCommand.ExecuteNonQuery()

end if
End Sub
******************** End Code ********************

******************** Start Error Message *****************
Server Error in '/' Application.
--------------------------------------------------------------------------------

Could not delete from specified tables.
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 29: DA.DeleteCommand = New OleDbCommand(delCmd, Con)
Line 30: Con.Open
Line 31: DA.DeleteCommand.ExecuteNonQuery()
Line 32: '************************************
Line 33: end if
Source File: c:\inetpub\wwwroot\ASPClass\FinalProj\ShopSignIn.a spx Line:
31

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) +154
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() +54
ASP.ShopSignIn_aspx.Page_Load(Object Sender, EventArgs e) in
c:\inetpub\wwwroot\ASPClass\FinalProj\ShopSignIn.a spx:31
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +29
System.Web.UI.Page.ProcessRequestMain() +742
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.0.3705.6018; ASP.NET
Version:1.0.3705.6018

******************** End Error Message *********************
Thank you for your help.

Mark

Nov 22 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
> DELETE * FROM ORDERS

I believe this is incorrect.

Try "DELETE FROM ORDERS"

--
Dave Sexton
dave@www..jwaonline..com
-----------------------------------------------------------------------
"Mark" <Ma**@discussions.microsoft.com> wrote in message news:69**********************************@microsof t.com...
I get an error message when deleting rows from a table in Access database.

My understanding is that the error message relates to the sharing of the
Inetpub and the wwwroot directory.

While I have set the directories to "Share" in the properties window, it
still does not allow row removal.

I'm running Microsoft Windows XP, Professional, Version 2002, Service Pack 1.

The code is as follows and the error message is after it.
***************** Start Code ********************
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.Oledb" %>

Sub Page_Load(Sender as object, e as EventArgs)
if not isPostBack then

Dim Con As OleDbConnection = New OleDbConnection
Dim DA As OleDbDataAdapter = New OleDbDataAdapter
Dim ConnectString, delCmd, x as String

x = Server.Mappath("\ASPClass\FinalProj\DB.mdb")

ConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & x

Con.ConnectionString = ConnectString
delCmd = "DELETE * FROM ORDERS"

DA.DeleteCommand = New OleDbCommand(delCmd, Con)
Con.Open
DA.DeleteCommand.ExecuteNonQuery()

end if
End Sub
******************** End Code ********************

******************** Start Error Message *****************
Server Error in '/' Application.
--------------------------------------------------------------------------------

Could not delete from specified tables.
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 29: DA.DeleteCommand = New OleDbCommand(delCmd, Con)
Line 30: Con.Open
Line 31: DA.DeleteCommand.ExecuteNonQuery()
Line 32: '************************************
Line 33: end if
Source File: c:\inetpub\wwwroot\ASPClass\FinalProj\ShopSignIn.a spx Line:
31

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) +154
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() +54
ASP.ShopSignIn_aspx.Page_Load(Object Sender, EventArgs e) in
c:\inetpub\wwwroot\ASPClass\FinalProj\ShopSignIn.a spx:31
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +29
System.Web.UI.Page.ProcessRequestMain() +742
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.0.3705.6018; ASP.NET
Version:1.0.3705.6018

******************** End Error Message *********************
Thank you for your help.

Mark

Nov 22 '05 #2

P: n/a
Mark,

Have a look at this page, I don't think you want to use the statement as you
wrote it.

http://msdn.microsoft.com/library/de.../acfundsql.asp

I hope this helps,

Cor
Nov 22 '05 #3

P: n/a
Thanks for your comments.

I changed the SQL to "DELETE FROM ORDERS" but still get the same error.

I have been led to believe that the problem is not with the SQL, but is file
sharing related.

All of the directories within the directory path of the Access database have
been set to "Share the folder" with the permissions set to "Full Control" via
the directory's Properties Window. But to no avail. (The Database resides
in the c:\Inetpub\wwwroot\ASPClass\FinalProj directory.)

I'm running Microsoft Windows XP, Professional, Version 2002, Service Pack 1.

Is there aonther newsgroup which is focused on file sharing issues?

Thanks,

Mark


Nov 22 '05 #4

P: n/a
Mark,

What do you want to delete?

Cor
Nov 22 '05 #5

P: n/a
Sharing has nothing to do with web apps -- just networking. You want
to right-click on either the folder containing the DB or the DB file
itself and choose "Properties". On the security tab, you want to give
read/write permissions to either "Everyone" (not recommended for
production environments but OK for local projects) or the asp.net
account, usuall called "Launch IIS Process Account
(machinename\IWAM_machinename).

Cheers,
Chid

Nov 22 '05 #6

P: n/a
On Thu, 21 Apr 2005 19:04:03 -0700, "Mark" <Ma**@discussions.microsoft.com> wrote:

I get an error message when deleting rows from a table in Access database.

My understanding is that the error message relates to the sharing of the
Inetpub and the wwwroot directory.

While I have set the directories to "Share" in the properties window, it
still does not allow row removal.

I'm running Microsoft Windows XP, Professional, Version 2002, Service Pack 1.

The code is as follows and the error message is after it.

See the following MS KB article:

http://support.microsoft.com/default...b;en-us;316675
Paul
~~~~
Microsoft MVP (Visual Basic)
Nov 22 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.