I have a datatable in a schema whose sql statement is a join. I would want to modify each of the tables independently as can be done via delphis update object, etc. I have tried all settings and the only way it can be update is if a [target table] is specified the statements tab for the data table. Doing this will not suffice as i can no longer modify each of the tables in the join. Using an updateable view is ruled out as it requires that a simple sql join has to be handled in the DB.
Therefore, Is it possible to update a joined table from the client using relativity server.
I am using Relativity Server at the back end and cannot/dont know how to add a business processor. I have defined custom commands for update and even assigned the command to the datatables updatecommandname, but no dice.
Using commands you can define your own statement and this statement will be used when datatable is updating. To use commands please do the next steps:
Open Schema file in Schema Modeler.
Create new command using New Command item on Commands panel. Create new statement for it using NewStatement item. Set Connection property. Set SQL statement for it, for example:
UPDATE [Orders]
SET
[OrderDate] = :OrderDate,
[OrderStatus] = :OrderStatus,
[CustomerId] = :CustomerId,
[EmployeeId] = :EmployeeId
WHERE
([Id] = :OLD_Id)
Save the statement. Recreate parameters for it.
3. Choose DataTable you need. Choose created update command in UpdateCommandName property for DataTable. Please note, that all parameters, presented in update command statement should be defined in SELECT statement for data table.
4. Save changes in schema.
5. On the client side you may work with dataset as usually. For example, to update datatable you may use:
fDataModule.DataAdapter.Update(newDataset,new string[1] {“TableName”});
Doing the steps above you will allow to work not with whole resultset but with separate data table in this resultset.
*** I didn’t put the table name in square brackets. ***
It shouldn’t be the cause of the problem. This exception message appears when client tries to use a datatable that is not presented in the Schema. For example, if client tries to update data table “Orders”
fDataModule.DataAdapter.Update(newDataset,new string[1] {“Orders”});
but server Schema doesn’t contain such a table or it’s name not “Orders”, but for example “Orders1”, then appropriate exception message will be shown. Another case, if you put the table name in square brackets on the client side. For example:
fDataModule.DataAdapter.Update(newDataset,new string[1] {“[Orders]”});
In this case you need to put the table name without brackets.
Check these situations please.
If it isn’t the cause of the problem please send us stacktrace and small testcase with the problem to investigate it in details.