Moorzee
Well-known member
I have lots of textboxes on a form bound at run time to a dataset. How do I reflect any changes made in the textboxes to the dataset then onto the db. I have tried dataset.getchanges then dataadapter.update(dataset,"tablename") but nothing occurs.
Have placed a button with dataset.getchanges then messagebox showing dataset.haschanges
false,
then acceptchanges the messagebox shows false.
AAAAAAAAAAaaaaaaaaaaaaaaaaaaaaaarrrrrrggghhhhh!
Pleeeease help me.
Thanks.
Update:
dim str as String
str = dsStaffData.Tables("Staff").Rows(0)(0, DataRowVersion.Original) & " :" & dsStaffData.Tables("Staff").Rows(0)("Surname", DataRowVersion.Original) & dsStaffData.Tables("Staff").Rows(0)("ForeNames", DataRowVersion.Original)
MsgBox("Original Vals: " & str) 'Shows original vals
str = dsStaffData.Tables("Staff").Rows(0)(0, DataRowVersion.Current) & " :" & dsStaffData.Tables("Staff").Rows(0)("Surname", DataRowVersion.Current) & dsStaffData.Tables("Staff").Rows(0)("ForeNames", DataRowVersion.Current)
MsgBox("Current Vals: " & str)'Still has original vals at this point
str = dsStaffData.Tables("Staff").Rows(0)(0, DataRowVersion.Proposed) & " :" & dsStaffData.Tables("Staff").Rows(0)("Surname", DataRowVersion.Proposed) & dsStaffData.Tables("Staff").Rows(0)("ForeNames", DataRowVersion.Proposed)
MsgBox("Proposed Vals: " & str)'The edits are here so all as I would expect
dsStaffData.AcceptChanges()
MsgBox("Changes Accepted")
str = dsStaffData.Tables("Staff").Rows(0)(0, DataRowVersion.Original) & " :" & dsStaffData.Tables("Staff").Rows(0)("Surname", DataRowVersion.Original) & dsStaffData.Tables("Staff").Rows(0)("ForeNames", DataRowVersion.Original)
MsgBox("Original Vals: " & str)'Changes reflected in dataset at this point. I'm still ok up to now......
str = dsStaffData.Tables("Staff").Rows(0)(0, DataRowVersion.Current) & " :" & dsStaffData.Tables("Staff").Rows(0)("Surname", DataRowVersion.Current) & dsStaffData.Tables("Staff").Rows(0)("ForeNames", DataRowVersion.Current)
MsgBox("Current Vals: " & str)'Changes are here so still I am ok.
'THIS Returns false everytime!!!!!!!!! Why has the ds not changed when I've accepted changes??????????
MsgBox("Does the dataset have changes man? " & dsStaffData.HasChanges.ToString())
Have placed a button with dataset.getchanges then messagebox showing dataset.haschanges
false,
then acceptchanges the messagebox shows false.
AAAAAAAAAAaaaaaaaaaaaaaaaaaaaaaarrrrrrggghhhhh!
Pleeeease help me.
Thanks.
Update:
dim str as String
str = dsStaffData.Tables("Staff").Rows(0)(0, DataRowVersion.Original) & " :" & dsStaffData.Tables("Staff").Rows(0)("Surname", DataRowVersion.Original) & dsStaffData.Tables("Staff").Rows(0)("ForeNames", DataRowVersion.Original)
MsgBox("Original Vals: " & str) 'Shows original vals
str = dsStaffData.Tables("Staff").Rows(0)(0, DataRowVersion.Current) & " :" & dsStaffData.Tables("Staff").Rows(0)("Surname", DataRowVersion.Current) & dsStaffData.Tables("Staff").Rows(0)("ForeNames", DataRowVersion.Current)
MsgBox("Current Vals: " & str)'Still has original vals at this point
str = dsStaffData.Tables("Staff").Rows(0)(0, DataRowVersion.Proposed) & " :" & dsStaffData.Tables("Staff").Rows(0)("Surname", DataRowVersion.Proposed) & dsStaffData.Tables("Staff").Rows(0)("ForeNames", DataRowVersion.Proposed)
MsgBox("Proposed Vals: " & str)'The edits are here so all as I would expect
dsStaffData.AcceptChanges()
MsgBox("Changes Accepted")
str = dsStaffData.Tables("Staff").Rows(0)(0, DataRowVersion.Original) & " :" & dsStaffData.Tables("Staff").Rows(0)("Surname", DataRowVersion.Original) & dsStaffData.Tables("Staff").Rows(0)("ForeNames", DataRowVersion.Original)
MsgBox("Original Vals: " & str)'Changes reflected in dataset at this point. I'm still ok up to now......
str = dsStaffData.Tables("Staff").Rows(0)(0, DataRowVersion.Current) & " :" & dsStaffData.Tables("Staff").Rows(0)("Surname", DataRowVersion.Current) & dsStaffData.Tables("Staff").Rows(0)("ForeNames", DataRowVersion.Current)
MsgBox("Current Vals: " & str)'Changes are here so still I am ok.
'THIS Returns false everytime!!!!!!!!! Why has the ds not changed when I've accepted changes??????????
MsgBox("Does the dataset have changes man? " & dsStaffData.HasChanges.ToString())
Last edited: