godkevin Posted April 20, 2003 Posted April 20, 2003 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 Quote
hemenkap Posted April 20, 2003 Posted April 20, 2003 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 Quote
*Experts* jfackler Posted April 20, 2003 *Experts* Posted April 20, 2003 (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 April 20, 2003 by jfackler Quote
Cassio Posted April 21, 2003 Posted April 21, 2003 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. Quote Stream of Consciousness (My blog)
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.