Dick Bowman wrote:This begins to sound like a Dyalog bug to me
This is not a bug, just a issue and require from us to be more delicate with .Net. Just an example, and I don't know how it will be better by Dyalog behavior:
ADO.NET. I show just a major things, if anybody need a APL code I will provide
1. Create a connection to database []NEW SqlClient.SqlConnection
2. Create a datatable []NEW DataTable
3. Create a adapter for table []NEW SqlClient.SqlAdapter
4. Create a command to retrieve a rows for our DataTable []NEW SqlClient.SqlCommand 'SELECT * FROM MYTABLE'
5. FillSchema and Fill our datatable
6. Create command builder to get a three commands for INSERT/UDDATE/DELETE statements. []NEW SqlClient.SqlCommandBuilder
7. Reference command builder to our adapter. Assign to our adapter properties with appropriate commands. builder.Adapter<-adapter and adapter.UpdateCommand<-builder.GetUpdateCommand (the same for insert and delete command)
8. Set any value to any row in our datatable
9. Update database by calling adapter.Update
SUCCESS
take a look on builder object. This class can help to developer to write correct statements for updating our database. What we need from him - three commands only to assign it to our adapter.
Make changes. Do everything in function and make builder as a local variable. This object don't need as soon as he provide us with update statements.
Run function - SUCCESS. Like we a predict. To delete just a APL variable builder don't delete a instance builder itself.
Add a line between 7 and 8. builder.Dispose
Run function - EXCEPTION. Adapter don't has an appropriate commands. Adapter.UpdateCommand - VALUE ERROR. Opps, why? We assign a commands to adapter in line 7.
By builder.Dispose we dispose a builder itself and all his commands.