update problem in DataGrid's UpdateCommand method

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
 
D

Daniel Bass

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,206
Latest member
SybilSchil

Latest Threads

Top