Can't update Current Row in Dataset

giancasa

New member
Joined
Nov 30, 2010
Messages
4
Programming Experience
Beginner
Hi All,

This is my first post ,

I can not understand why I can't save the current record of a dataset.

Let me explain ...
I have a small application with a management admin ...
I have a single admin password, the user can change it and so I created a classical form ( old password, new password, repeat new password).

When I click the confirm button:
- filtering the data set with old-password
- when the old password match --> I take the current record
- Update the current record

i have no error but on the db the record doesn't update.

here the code for the button ...
VB.NET:
        'Validating input
        Me.ChangePassAdminDataSource.Filter = " password ='" & UtilPuzz.normString(Trim(TxtOldPassword.Text)) & "'"
        If Me.ChangePassadminDataSource.Count = 1 Then
            Dim o As GCSDataSet.passAdminRow
            o = Me.ChangePassAdminDataSource.Current.row
            o.BeginEdit()
            o.password = TxtNewPassword.Text
            o.EndEdit()
            Me.ChangePassAdminDataSource.EndEdit()
            Try
                Me.PassAdminTableAdapter.Update(Me.GCSDataSet.passAdmin)
                Me.GCSDataSet.AcceptChanges()
                MsgBox("Password mod ok .", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Pass..")
            Catch ex As OleDb.OleDbException
                MsgBox("Error")
            End Try
        Else
            MsgBox("Wrong pass", MsgBoxStyle.Exclamation + MsgBoxStyle.OkOnly, "Pass...")
        End If


Thank you in advance and sorry for my bad english :p

GianCasa ^ _ ^
Ascolta
Trascrizione fonetica
 
The first thing to do is to check the value returned by Update. If it's not zero then the data is being saved and you're just looking for it in the wrong place or at the wrong time. In that case, follow the first link in my signature and that should enlighten you.
 
Hi jmcilhinney,

Thanks for reply!

I will check the return value of update, but that 's the right approach for update records in a datasource ?

Thanks again!

GianCasa
 
I understand where was the error. I created two datasets. when I removed the second I managed to save the current record.

Thanks again jmcilhinney

Happy new year
 
Back
Top