Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to Update Not Bounded Fields
Message
 
To
11/01/2003 17:45:42
General information
Forum:
ASP.NET
Category:
ADO.NET
Miscellaneous
Thread ID:
00739818
Message ID:
00740751
Views:
32
I did all this trace in the last 2 days, I found somthing strange, see what it's happening:

Remember the code I sent you before about adding a new Row to the DS, starts from there :
**1 ))
Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
pbbolAddNew = True

myDA.InsertCommand = myCB.GetInsertCommand

With BindingContext(myDS, "Company")
.AddNew()
.Position = .Count - 1
cbSelect.SelectedIndex = .Count - 1
End With
End Sub

**2 ))
The form will be active for user entry, then user should click the Save button here.... up to here all trace and operations are fine, Save Code:

Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
' ** this is the manual update for the ID field
myDR("CompanyID") = 10

' Call update data procedure
Call UpdateDS()

' ** 3 pls the notes down **

Call MyFormStandard()
Call MyDisableEnable()
End Sub

Private Sub UpdateDS()
Try
Me.BindingContext(myDS, "Company").EndCurrentEdit()
myDA.Update(myDS, "Company")
Catch
' Error will be displayed if another user edited the data same time
funMsgCenter(Err.Description, Err.Number)
funMsgCenter("Data Not Saved/Deleted, Reload Your Data.", "")
myDS.RejectChanges()
End Try

myDS.AcceptChanges()
End Sub

Notes for #3:
the problem starts here the typed data in the form is stored to the new row correctly, but the new ID value saved in the first Row in the ComboBox
and the new saved row remain with a blank manual ID !!
How the row position jumbed from the new row (.position = last row) to the first row!!
This I don't understand it?



>Ahmad,
>
>No, the DataBinding is NOT your problem. Updating the backend database from a DataSet that has been modified both manually and through data-bound controls works just fine. I've done it many times ... something else is wrong, but at this point I don't know what to suggest any more. If none of the things that I've suggested have worked, then I guess you need to try and focus more on *where* the problem is happening. Trace and step through your code and check your data both before and after you have made changes. Check and see what the RowState is before and after. Things like that ... I don't think I can offer any more suggestions unless I have more information.
>
>~~Bonnie
>
>
>>Hi Bonnie
>>
>>It's still the same problem, and all that because of the DataBinding.
>>Do you advice to leave the DataBinding and do all the thing by codding, as I used to do in the ole days VB6 ?
<><><><><><><><><><><><><><><><><><><><>
<><> REMEMBER,,,,KNOWLEDGE IS POWER <><>
<><><><><><><><><><><><><><><><><><><><>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform