Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

i'm currently doing a client-server programming. however i 've got problem in updating the password.. the code below is the function i wrote to update the password.. but when i go back and check the database, the password is not updated.. could someone help me please??

 

 

 

Function UpdatePassword(ByVal oPwd As String, ByVal nPwd As String)

 

Dim row As DataRow

DbD_ALL1.Clear()

Me.OleDbUpdateCommand1.CommandText = "Update Login Set Password = '" & nPwd & "' Where Password = '" & oPwd & "'"

Me.DBA_Users1.UpdateCommand = Me.OleDbUpdateCommand1

DBA_Users1.Fill(DbD_ALL1, nPwd) 'password

 

For Each row In DbD_ALL1.Tables(0).Rows

row("Pasword") = nPwd

 

Next

MsgBox("Password Updated")

End Function

Posted

hi,

 

i think you are not calling Dataset.Update to reflect the in memory changes back to the database. might be that is the reason your database is not geting updated. try checking if the changes you make in the memory are actually happenning using breakpoint in the code. if they are then you need to reflect then back to the database using Dataset.Update

  • *Experts*
Posted (edited)

Looks like an execute non query would make more sense here.

I don't see a data set being used.

Since your passing in the values, you could simply update the source and then run a .fill on the dataadapter object

to reflect the changes made in the nonquery.

 

Here's a link.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vbcode/html/vbtskcodecallingexecutenonquerymethodofdatacommandvisualbasic.asp

 

Anyone else have an idea?

 

Jon

Edited by jfackler
Posted
If you´re just updating the database, I think you´d better go for the ExecuteNonQuery method. But if you want to use a dataset you have to call the method to update the database(dataadapter.fill), otherwise the changes will never affect the real database.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...