T
tbends
I have a simple access database with one table name "Models". When I try to
delete using the following code I keep getting the error: Could not delete
from specified tables. Any help is greatly appreciated, I assume it has
something to do with permissions.
Code:
OleDbConnection dbConn = null;
OleDbCommand dbComm = null;
dbConn = new OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;Data
Source=c:\\db1.mdb;");
dbComm = new OleDbCommand("Delete * From Models;", dbConn);
dbComm.Connection.Open();
dbComm.ExecuteNonQuery();
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) +174
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() +66
WHomes.Models.btnDelete_Click(Object sender, ImageClickEventArgs e) in
c:\inetpub\wwwroot\whomes\models.aspx.cs:144
System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e) +109
System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +69
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1277
delete using the following code I keep getting the error: Could not delete
from specified tables. Any help is greatly appreciated, I assume it has
something to do with permissions.
Code:
OleDbConnection dbConn = null;
OleDbCommand dbComm = null;
dbConn = new OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;Data
Source=c:\\db1.mdb;");
dbComm = new OleDbCommand("Delete * From Models;", dbConn);
dbComm.Connection.Open();
dbComm.ExecuteNonQuery();
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) +174
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() +66
WHomes.Models.btnDelete_Click(Object sender, ImageClickEventArgs e) in
c:\inetpub\wwwroot\whomes\models.aspx.cs:144
System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e) +109
System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +69
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1277