473,545 Members | 2,081 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error Deleting Table from Access DB

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

Nov 19 '05 #1
1 1511
> delCmd = "DELETE * FROM ORDERS"

This looks like an SQL command to delete all rows from the orders table
(not the orders table itself.) The proper syntax is without the *:

DELETE FROM ORDERS

If you would rather delete a single order only, try something like:

DELETE FROM ORDERS WHERE ORDERNR = 'MyOrderNumber'

Greetings,
Wessel
Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1912
by: Mark | last post by:
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="System.Data" %> <%@ import Namespace="System.Data.Oledb" %>
4
2922
by: Mark | last post by:
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="System.Data" %> <%@ import Namespace="System.Data.Oledb" %>
1
201
by: Mark | last post by:
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="System.Data" %> <%@ import Namespace="System.Data.Oledb" %>
1
3178
by: sphinney | last post by:
All, I'm not sure how to adequately explain my problem in two sentences or less, so at the risk of providing TMI, here's the condensed verion. I have developed an Access 2002 database file that contains a form, multiple queries and multiple reports. The purpose of the form is to allow the user to run various queries against my company's...
0
7468
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7808
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7757
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
4945
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3450
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3443
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1884
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1014
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
704
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.