I have two tables that have a one to one relationship.
I want to quickly set up a datagrid that allows users to edit values in both tables where one row is displayed
in one grid to represent the two tables.
I have dragged and dropped one data source table1 on to a windows form as a datagrid.
I have then edited the auto-generated SelectCommand to join table1 to table2 and include the relevant fields
After changing the select command I was careful not to auto-generate the Update and delete commands as they would go mad with
two tables present in the Select statement.
I then manually changed the Update Statement for the table adapter so it has two UPDATE commands in it seperated by a ';'.
The first UPDATE command still updates the first table just as it was auto-generated when I dragged the table on to the form.
The second UPDATE command I coded myself to update the second table fields I brought in by changing the SELECT statement.
At run time the datagrid shows my extra fields from the select join.
The data grid also tries to execute both UPDATE statements but does not like the ';' that indicates the end of the first statement.
The error message is 'Token ; was no valid. Valid toekn :<END-OF-STATEMENT>'.
This may be a unique issue to the Iseries/AS400 database that I am trying to update.
So I have a couple of questions:-
1) Can you have more than one UPDATE statement in the Update Command of a datagrid?
2) Should I use something else instead of ';' to seperate the commands?
3) Is a better approach to execute the update via one statement that calls a stored procedure that
performs both update commands?.
Dazed and confused.
Remember.. 'Depression is just anger without enthusiasum'.
I want to quickly set up a datagrid that allows users to edit values in both tables where one row is displayed
in one grid to represent the two tables.
I have dragged and dropped one data source table1 on to a windows form as a datagrid.
I have then edited the auto-generated SelectCommand to join table1 to table2 and include the relevant fields
After changing the select command I was careful not to auto-generate the Update and delete commands as they would go mad with
two tables present in the Select statement.
I then manually changed the Update Statement for the table adapter so it has two UPDATE commands in it seperated by a ';'.
The first UPDATE command still updates the first table just as it was auto-generated when I dragged the table on to the form.
The second UPDATE command I coded myself to update the second table fields I brought in by changing the SELECT statement.
At run time the datagrid shows my extra fields from the select join.
The data grid also tries to execute both UPDATE statements but does not like the ';' that indicates the end of the first statement.
The error message is 'Token ; was no valid. Valid toekn :<END-OF-STATEMENT>'.
This may be a unique issue to the Iseries/AS400 database that I am trying to update.
So I have a couple of questions:-
1) Can you have more than one UPDATE statement in the Update Command of a datagrid?
2) Should I use something else instead of ';' to seperate the commands?
3) Is a better approach to execute the update via one statement that calls a stored procedure that
performs both update commands?.
Dazed and confused.
Remember.. 'Depression is just anger without enthusiasum'.