[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.odbcnet

MS Access 2003 table data is not getting deleted

MS Access 2003 delete problem

4/7/2005 9:01:00 AM

Hi,

My program in C# got executed fine with MSAccess 2000 as its backend. I was
able to delete the data and insert new data in my table. But after upgrading
the Access to MS Access 2003, I'm able to access the data (Do a select from
the table) but i'm not able to delete the data from the table. It throws an
error,

"An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred
in system.data.dll".

Please help me out to solve this issue. Below is my code,

string delete = "DELETE * FROM [Resource Details]" ;
// Opening a DB connection
OleDbConnection ExcConnection = new OleDbConnection(
@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\Tool\Resource Details.mdb
User Id=admin;Password=;" );

OleDbCommand ExcCommand = new OleDbCommand( @"SELECT * FROM [Resource
Details]", ExcConnection );

// Commandset to delete the table
OleDbCommand deleteCommand = new OleDbCommand(delete,ExcConnection);

ExcConnection.Open();
deleteCommand.ExecuteNonQuery();
ExcConnection.Close();


Error occurs at : deleteCommand.ExecuteNonQuery();

1 Answer

Paul Clement

4/7/2005 2:12:00 PM

0

On Thu, 7 Apr 2005 02:01:04 -0700, "MS Access 2003 delete problem" <MS Access 2003 delete
problem@discussions.microsoft.com> wrote:

&#164; Hi,
&#164;
&#164; My program in C# got executed fine with MSAccess 2000 as its backend. I was
&#164; able to delete the data and insert new data in my table. But after upgrading
&#164; the Access to MS Access 2003, I''m able to access the data (Do a select from
&#164; the table) but i''m not able to delete the data from the table. It throws an
&#164; error,
&#164;
&#164; "An unhandled exception of type ''System.Data.OleDb.OleDbException'' occurred
&#164; in system.data.dll".
&#164;
&#164; Please help me out to solve this issue. Below is my code,
&#164;
&#164; string delete = "DELETE * FROM [Resource Details]" ;
&#164; // Opening a DB connection
&#164; OleDbConnection ExcConnection = new OleDbConnection(
&#164; @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\Tool\Resource Details.mdb
&#164; User Id=admin;Password=;" );
&#164;
&#164; OleDbCommand ExcCommand = new OleDbCommand( @"SELECT * FROM [Resource
&#164; Details]", ExcConnection );
&#164;
&#164; // Commandset to delete the table
&#164; OleDbCommand deleteCommand = new OleDbCommand(delete,ExcConnection);
&#164;
&#164; ExcConnection.Open();
&#164; deleteCommand.ExecuteNonQuery();
&#164; ExcConnection.Close();
&#164;
&#164;
&#164; Error occurs at : deleteCommand.ExecuteNonQuery();

Do you have any more information on the error? There is typically error information that is a bit
more specific than what you posted.


Paul
~~~~
Microsoft MVP (Visual Basic)