hi, i have a program which loads a job. this job has items called (phsyical) keys. for e.g.
job11 has 2 keys, which i entered previously.
the goal of the program, is to load a job, and then the user can add or delete keys from the job.
i have a table "KeyData"in my access database with for e.g. 2 fields:
i have a dataadapter called daKeyData, and this dataadapter has the commands to update, delete, select and insert into
i also generated a dataset "dsKeyData" from the dataadapter (having 2 fields)
now i added another field tot the bottom of the dataset because i need to display another descriptive item.
this other field is from the "MasterKeyData" table.
now the user selects a job and i use a typed dataadapter to fill the dataset:
Dim da1 As New OleDbDataAdapter("SELECT KeyData.FIELD1, MasterKeyData.Description,
KeyData.FIELD2 FROM KeyData INNER JOIN
MasterKeyData ON KeyData.KeyCodeID = MasterKeyData.KeyCodeID WHERE (Keydata.JOBID = 11)", myConnection)
now the dataset is filled and i generate a dataview and connect it to a datagrid
dv = New DataView(DsKeyData1.Tables
myDataGrid.DataSource = dv
now the data is displayed on the datagrid:
FIELD1 FIELD2 Field3
Row1 Data1a Data1b Data1c
Row2 Data2a Data2b Data2c
now the user has the option to add and delete keys from the datagrid.
when the user adds a key:
'allow for the dataview to add one record
dv.AllowNew = True
Dim NewKey As DataRowView = dv.AddNew
dv.AllowNew = False
'set the details of the new key, i know the jobid
NewKey("Field1") = 1
NewKey("Field2") = "X"
No problem so far, the problem comes when i try to save:
i use a try block , im just displaying the working code for it. when i add a key, and save, it runs through the
code with out errors, but it never writes away to the database
now when i delete a row and try to save, it says "Concurrency violation: 0 rows affected"
i am dead sure its not a error in the dataadapters side, it generated without any errors
i am really at a loss here, i spent at least a day on this already.
ive got the whole project with comments at:
just click add row, and check the last item in the modal form, and press return.URL: (70k)