Not sure this is the right place for this questions, but here goes:
I get an error message when deleting an table from a Access database.
The code is as follows and the error message is after it.
*************** ** Start Code *************** *****
<%@ import Namespace="Syst em.Data" %>
<%@ import Namespace="Syst em.Data.Oledb" %>
Sub Page_Load(Sende r as object, e as EventArgs)
if not isPostBack then
'************* Delete previous orders ********
Dim Con As OleDbConnection = New OleDbConnection
Dim DA As OleDbDataAdapte r = New OleDbDataAdapte r
Dim ConnectString, delCmd, x as String
x = Server.Mappath( "\ASPClass\Fina lProj\DB.mdb")
ConnectString = "Provider=Micro soft.Jet.OLEDB. 4.0;Data Source=" & x
Con.ConnectionS tring = ConnectString
delCmd = "DELETE * FROM ORDERS"
DA.DeleteComman d = New OleDbCommand(de lCmd, Con)
Con.Open
DA.DeleteComman d.ExecuteNonQue ry()
'************** *************** *************** *
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.Ole Db.OleDbExcepti on: Could not delete from
specified tables.
Source Error:
Line 29: DA.DeleteComman d = New OleDbCommand(de lCmd, Con)
Line 30: Con.Open
Line 31: DA.DeleteComman d.ExecuteNonQue ry()
Line 32: '************** *************** *******
Line 33: end if
Source File: c:\inetpub\wwwr oot\ASPClass\Fi nalProj\ShopSig nIn.aspx Line:
31
Stack Trace:
[OleDbException (0x80004005): Could not delete from specified tables.]
System.Data.Ole Db.OleDbCommand .ExecuteCommand TextErrorHandli ng(Int32 hr)
+41
System.Data.Ole Db.OleDbCommand .ExecuteCommand TextForSingleRe sult(tagDBPARAM S
dbParams, Object& executeResult) +154
System.Data.Ole Db.OleDbCommand .ExecuteCommand Text(Object& executeResult)
+92
System.Data.Ole Db.OleDbCommand .ExecuteCommand (CommandBehavio r behavior,
Object& executeResult) +65
System.Data.Ole Db.OleDbCommand .ExecuteReaderI nternal(Command Behavior
behavior, String method) +112
System.Data.Ole Db.OleDbCommand .ExecuteNonQuer y() +54
ASP.ShopSignIn_ aspx.Page_Load( Object Sender, EventArgs e) in
c:\inetpub\wwwr oot\ASPClass\Fi nalProj\ShopSig nIn.aspx:31
System.Web.UI.C ontrol.OnLoad(E ventArgs e) +67
System.Web.UI.C ontrol.LoadRecu rsive() +29
System.Web.UI.P age.ProcessRequ estMain() +742
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.0.370 5.6018; ASP.NET
Version:1.0.370 5.6018
*************** ***** End Error Message *************** ******
Thank you for your help.
Mark