Globadapter. Update (contactsdataset1.tables [ " Accessories " ]);
AboveCodeThe parameter of the function in can be dataset or datatable as shown above, which can be set according to the actual situation. However, the following error occurs:
When a datarow set with modified rows is passed, the update requires a valid updatecommand. Later, I checked the online materials and found that "sqldataadapter does not automatically generate the transact-SQL statements required for dataset changes and the coordination between the associated SQL Server instances. However, ifSqldataadapterYou can create an SQlcommandbuilderObject To automatically generate a Transact-SQL statement for updating a single table. Then,QlcommandbuilderAny other unconfigured Transact-SQL statement is generated. Add statement
This . Globcommandbuilder = New Sqlcommandbuilder (globadapter );
The problem can be solved.