Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to Update Not Bounded Fields
Message
From
12/01/2003 10:40:12
 
General information
Forum:
ASP.NET
Category:
ADO.NET
Miscellaneous
Thread ID:
00739818
Message ID:
00740783
Views:
55
Ahmad,

A few questions:

You have the following statement in the btnSave_Click() method:
    myDR("CompanyID") = 10
Where does myDR come from? I don't see the code for that. Perhaps you're doing that part wrong.

Also, another possibility might be something wrong with how you're doing the combobox. What is the DataSource for your combo? It should *not* be the same DataSet that you are binding too ... if you *are* doing that, then that might explain your problems.

~~Bonnie


You have
>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 ?
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform