update problem in DataGrid's UpdateCommand method

  • Thread starter Thread starter dawn
  • Start date Start date
D

dawn

Hi, anyone can help me to solve this little problem that
i've spent a lot of time to solve it!! but i can't!!!!

actually, i use a DataGrid, and i'd like to save the
changed data! ( this is just a trial method and i'll
use this method with a more complique method later,
that's why i can't use MxDataGrid)

but each time, DataGrid save the original data, not the
one after changed in the Textbox!!!
i've used Database Update Method!!!
but it can't save the new data in the database!
even though i use a Label6 to show out the changed data,
it can't show the new data too!!!

here is the code!!
anyone can give me a hand???

thanks!!!

Dawn
------------------------------
Sub MyDataGrid_UpdateCommand(sender As Object, e As
DataGridCommandEventArgs)
Dim Ucode As TextBox = e.Item.Cells(1).Controls(0)
Dim Unom As TextBox = e.Item.Cells(2).Controls(0)
Dim Uetage As TextBox = e.Item.Cells(3).Controls(0)
Dim Ubureau As TextBox = e.Item.Cells(4).Controls(0)

Dim Upid As integer = e.Item.ItemIndex + 1
Dim Upcode As String = Ucode.Text
Dim Upnom As String = Unom.Text
Dim Upetage As String = Uetage.Text
Dim UpBureau As String = Ubureau.Text

Label6.Text= Upid & "--"& Upnom &"---" & Upcode & "--

UpdateSite(5,Upnom,Upcode,Upetage,UpBureau)
MyDataGrid.EditItemIndex = -1
BindGrid
End Sub
 
you need to trace through the code and check the values passed into the 4
Strings you're pulling off the textboxes, then step into the UpdateSite
function to check this does what it says on the tin, i suspect it's in this
method that your problem lies.

Dan.

ps. it's worth noting your first parameter is "5" in the UpdateSite...
should this perhaps be Upid?
 
Back
Top