Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Database Not Updating
Message
 
To
07/01/2003 12:17:13
General information
Forum:
ASP.NET
Category:
ADO.NET
Miscellaneous
Thread ID:
00738492
Message ID:
00738891
Views:
34
Yes, it works fine, but why it shows the RowState as UnChanged when I save the data, although it's saved to the database when I view it from the ServerExplorer?


>Yes, see, that's my point ... your row position is not changing. You need to do something like this (keep in mind that I'm not sure of the VB syntax):
>
>
>BindingContext(myDS, "Bank").Position = cbSelect.SelectedIndex
>
>
>Of course, this assumes that the order of what you display in the Combo is the same order as your DataSet (which it probably is).
>
>Also, for the BindingContext, I seem to remember reading somewhere that it was better to do this:
>
>BindingContext(myDs.Bank)
>
>rather than the way you have done it, although I'm not sure why it was better. It could be that I'm remembering that it's important not to mix-and-match. IOW, don't do the Binding one way one time and the other way the next time ... I *know* that *that's* a big no-no.
>
>~~Bonnie
>
>
>>I am trying this code to see the position but it always shows 0, what should I add here.
>>Private Sub cbSelect_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cbSelect.SelectedIndexChanged
>>MsgBox(BindingContext(myDS, "Bank").Position)
>>End Sub
>>
>>
>>>Yes. Changing what you select in the ComboBox is not changing the row position for the rest of your controls on your form. You need to change the row position as I have stated.
>>>
>>>
>>>
>>>>I am using DataBinding, do I still have to use SelectedIndexChanged event?
>>>>
>>>>
>>>>>Yeah, I think I know what you mean now. You are using the ComboBox for navigation, correct? But you're not doing it correctly. You never move to the 5th row and you're always updating the 1st row. In some change event for the ComboBox (probably the SelectedIndexChanged event) you need to change your BindingContext.Position to the appropriate row. That should solve your problem ...
>>>>>
>>>>>What threw me off is that I thought you said that the DataSet was changing ok, but the Database was not updating. This wasn't the case ....
>>>>>
>>>>>~~Bonnie
>>>>>
>>>>>
>>>>>
>>>>>>Ok, assume I selected the first Row in the ComboBox, and then updated the data according to the following fields:
>>>>>>User Name: Ahmad
>>>>>>Title: System Analyst
>>>>>>Then I clicked the Save button, data saved correctly. RowState is Updated
>>>>>>
>>>>>>Now, I’ll select another row from the ComboBox, say the 5th row in the ComboBox list, and updated the data as follows:
>>>>>>User Name: Sara
>>>>>>Title: Developer
>>>>>>Then I clicked the Save button. RowState is UnChanged
>>>>>>
>>>>>>Now what happens, the first Row (Record) which having “Ahmad” value in “UserName” Field, is replaced with “Sara”, and “Title” filed with value “Systems Analyst” replaced with “Developer”.
>>>>>>
>>>>>>And the 5th Row still having the old data.
>>>>>>Hope it’s clear now
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>>Sorry Ahmad, I'm still not following what you are saying. =(
>>>>>>>
>>>>>>>
>>>>>>>
<><><><><><><><><><><><><><><><><><><><>
<><> REMEMBER,,,,KNOWLEDGE IS POWER <><>
<><><><><><><><><><><><><><><><><><><><>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform