Link to home
Start Free TrialLog in
Avatar of Hagita
HagitaFlag for Israel

asked on

Changing value of bound datagridview cell

Hello experts, I am trying to set a value in datagridview via code. the grid is bound to a bounding source.
apparently the data base wont update. this is my code:


Dim row As DataRow = DirectCast(Me.TblLaboratoryBindingSource1.Current, DataRowView).Row
                row("Nomicrosection") = lngNewSeedNoMicroSection
                row("TestDate") = DateTime.Now
                dtgLab.Item("Nomicrosection", i).Value = lngNewSeedNoMicroSection
                dtgLab.Item("TestDate", i).Value = DateTime.Now
dtDataTable.GetChanges()

       
            TblLaboratoryTableAdapter.Update(dtDataTable.Select(Nothing, Nothing, DataViewRowState.Deleted))
           
            TblLaboratoryTableAdapter.Update(dtDataTable.Select(Nothing, Nothing, DataViewRowState.ModifiedCurrent))
         
            TblLaboratoryTableAdapter.Update(dtDataTable.Select(Nothing, Nothing, DataViewRowState.Added))

            COCDataSet.tblLaboratory.AcceptChanges()
Avatar of Mike McCracken
Mike McCracken

What is the underlying query?

Does it use multiple tables?
If so it may be that it is not updateable

mlmcc
ASKER CERTIFIED SOLUTION
Avatar of Hagita
Hagita
Flag of Israel image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Hagita

ASKER

I solved it without using experts advice. Thank you