Befuddled

G

Guest

Not sure if this is the correct place for this question, but I'm kind of
grasping for straws at this point.

I get an error message when deleting rows from a table in Access database.
The original vb.net code is included below. It is running in an Asp.Net
structure.

My understanding is that the error message relates to the sharing of the
Inetpub and the wwwroot directories. I have set the Sharing Property to
"Share this file"and Permissions have been set to "Full Control". I still
get the error.

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.aspx Line:
31

Stack Trace:


[OleDbException (0x80004005): Could not delete from specified tables.]
System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr)
+41

System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS
dbParams, Object& executeResult) +154
System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
+92
System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior,
Object& executeResult) +65
System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(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.aspx: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
 
I

Ilyan Mishiyev

Check you database, maybe this might have something to do with it. Do you
have any other tables that reference the table you delete from? Do you have
any foreign keys specified? If you do, database will not allow you to delete
from this table until you delete all the data from referencing tables first.

Mark said:
Not sure if this is the correct place for this question, but I'm kind of
grasping for straws at this point.

I get an error message when deleting rows from a table in Access database.
The original vb.net code is included below. It is running in an Asp.Net
structure.

My understanding is that the error message relates to the sharing of the
Inetpub and the wwwroot directories. I have set the Sharing Property to
"Share this file"and Permissions have been set to "Full Control". I still
get the error.

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.aspx
Line:
31

Stack Trace:


[OleDbException (0x80004005): Could not delete from specified tables.]
System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr)
+41

System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS
dbParams, Object& executeResult) +154
System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
+92
System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior,
Object& executeResult) +65
System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(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.aspx: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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top