fail to update excel file via mdb

G

Guest

I have create a excel file with 2 columns and 2 rows for demonstration. The
excel file is then opened by ms access and therefore a mdb file was created.
The mdb file showing the correct linkage between the mdb and xls. The content
can be opened by both.

A new project created and “Data Form Wizard†is used to produce the window
form, without any amendment to the codes generated by VS.

Add data and update to the database okay. But changing the content or delete
to the database is not okay.

***Errors occur when changing to the databse:
"An unhandled exception of type 'System.InvalidOperationException' occurred
in Testing.exe

Additional information: Update requires a valid UpdateCommand when passed
DataRow collection with modified rows."


***Errors occur when deleting to the database:
"An unhandled exception of type 'System.InvalidOperationException' occurred
in Testing.exe

Additional information: Update requires a valid DeleteCommand when passed
DataRow collection with deleted rows."

Many thanks :))
Moomin Ma
 
D

David Lloyd

You need to add an UpdateCommand and DeleteCommand to the DataAdapter that
is updating the data.

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.


I have create a excel file with 2 columns and 2 rows for demonstration. The
excel file is then opened by ms access and therefore a mdb file was created.
The mdb file showing the correct linkage between the mdb and xls. The
content
can be opened by both.

A new project created and "Data Form Wizard" is used to produce the window
form, without any amendment to the codes generated by VS.

Add data and update to the database okay. But changing the content or delete
to the database is not okay.

***Errors occur when changing to the databse:
"An unhandled exception of type 'System.InvalidOperationException' occurred
in Testing.exe

Additional information: Update requires a valid UpdateCommand when passed
DataRow collection with modified rows."


***Errors occur when deleting to the database:
"An unhandled exception of type 'System.InvalidOperationException' occurred
in Testing.exe

Additional information: Update requires a valid DeleteCommand when passed
DataRow collection with deleted rows."

Many thanks :))
Moomin Ma
 

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