G
Guest
Here's my question..
I have a Dataset which has populated a datagrid with information from an AS400
That SQL looks like this
"Select MASYS, MAFLD, MADATA, MAEQV from QS36F.MAPDATA WHERE MASYS = ? AND MAFLD = ?
It populates a data adapter in which at that point I open a new dataset and I have the parameters and such setup including the proper update, insert and delete commands created as well. It works great
I can update and insert and all that wonderful stuff
Here's the problem..
I have another dataset which I open to when the user clicks on a button called "Build"
That SQL looks like this
"Select distinct 'EL0' as MASYS, 'CBMAK' as MAFLD, cbmak as MADATA, '' as MAEQV from qs36f.cgibase where cbmak not in (select madata from qs36f.mapdata where masys = 'EL0' and mafld = 'CBMAK')
The purpose of this "build" button is to grab a bunch of values that will be merged with the existing dataset
Consider this example...
You have a coat rack with 10 coats on it....5 of the coats have people who own them and the other five do not
The five who do have owners are currently populated into the datagrid with their owners names beside them. The other 5 however are not in the datagrid. The build button grabs the 5 coats without owners and merges that info into the existing dataset so that the user can add the names to the coats without names.
Here's the problem...the following lin
myconnection.getDataSet(datasetkey).Merge(myconnection.getDataSet(dsKey), True, MissingSchemaAction.AddWithKey
(getdataset retrieves a currently open dataset distinguished from another by a variable "datasetkey" or "dsKey". Both are just a random number integer value to keep track of open datasets
This line adds the newly opened dataset information to the datagrid and seems to add it to the original datagrid, however, when I try to modify information that has been merged I get this error on the update
An unhandled exception of type 'System.Data.DBConcurrencyException' occurred in system.data.dl
Additional information: Concurrency violation: the UpdateCommand affected 0 records
The update code looks like this..
Dim adapter As System.Data.Odbc.OdbcDataAdapter = myconnection.getAdapter(datasetkey
adapter.Update(CType(MyDataGrid.DataSource, System.Data.DataSet)
It crashes on the second line. When I try refreshing the original Dataset....the merged information is not there
Why does it merge the second datasets info to the datagrid but doesn't seem like it's being merged into the orginal dataset
Thank
I have a Dataset which has populated a datagrid with information from an AS400
That SQL looks like this
"Select MASYS, MAFLD, MADATA, MAEQV from QS36F.MAPDATA WHERE MASYS = ? AND MAFLD = ?
It populates a data adapter in which at that point I open a new dataset and I have the parameters and such setup including the proper update, insert and delete commands created as well. It works great
I can update and insert and all that wonderful stuff
Here's the problem..
I have another dataset which I open to when the user clicks on a button called "Build"
That SQL looks like this
"Select distinct 'EL0' as MASYS, 'CBMAK' as MAFLD, cbmak as MADATA, '' as MAEQV from qs36f.cgibase where cbmak not in (select madata from qs36f.mapdata where masys = 'EL0' and mafld = 'CBMAK')
The purpose of this "build" button is to grab a bunch of values that will be merged with the existing dataset
Consider this example...
You have a coat rack with 10 coats on it....5 of the coats have people who own them and the other five do not
The five who do have owners are currently populated into the datagrid with their owners names beside them. The other 5 however are not in the datagrid. The build button grabs the 5 coats without owners and merges that info into the existing dataset so that the user can add the names to the coats without names.
Here's the problem...the following lin
myconnection.getDataSet(datasetkey).Merge(myconnection.getDataSet(dsKey), True, MissingSchemaAction.AddWithKey
(getdataset retrieves a currently open dataset distinguished from another by a variable "datasetkey" or "dsKey". Both are just a random number integer value to keep track of open datasets
This line adds the newly opened dataset information to the datagrid and seems to add it to the original datagrid, however, when I try to modify information that has been merged I get this error on the update
An unhandled exception of type 'System.Data.DBConcurrencyException' occurred in system.data.dl
Additional information: Concurrency violation: the UpdateCommand affected 0 records
The update code looks like this..
Dim adapter As System.Data.Odbc.OdbcDataAdapter = myconnection.getAdapter(datasetkey
adapter.Update(CType(MyDataGrid.DataSource, System.Data.DataSet)
It crashes on the second line. When I try refreshing the original Dataset....the merged information is not there
Why does it merge the second datasets info to the datagrid but doesn't seem like it's being merged into the orginal dataset
Thank