Datagribview and combobox

aarontham
aarontham used Ask the Experts™
on
i populate a Datagribview with 3 table. ( adaptor.fill ) and  then there is a combobox.
user will select the combobox it will update the Datagribview.

but when i need to save it to database it don't work.

i use below code to save.
adaptor.Update(datatable)

i have below error.
Update requires a valid InsertCommand when passed DataRow collection with new rows.

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2012
Top Expert 2014

Commented:
Obadiah ChristopherDeveloper User Interface

Commented:
As far as I know, the concept is

u can either have just the select statement for an adaptor

or u need all three commands: insert, update & delete

Author

Commented:
command builder only work on 1 table . i have 3 table and join together.
Most Valuable Expert 2012
Top Expert 2014
Commented:
Then you can not do it i think. You have to devise some other way, use stored procedures, or configure the commands manually by defining parameters etc.
Jorge PaulinoIT Pro/Developer
Top Expert 2008
Commented:
I agree with CodeCruiser. You need to loop on the rows and update the records for each table.
The commandbuilder need an unique/primary key to identify the record in the right table/position.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial