how to change password and to update the changed password

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rekhasc
    New Member
    • Oct 2007
    • 66

    how to change password and to update the changed password

    plz help me to write the code to change the current password and to update the new password:

    i have written the code but its giving error,my code is
    [code=vb]
    Private Function pass() As Boolean
    Dim cn As New ADODB.Connectio n
    Dim rs As New ADODB.Recordset
    Dim sql As String

    cn.Open = "provider=micro soft.jet.OLEDB. 4.0;Data source=F:\icici \database.mdb;P ersist security info=true"

    sql = "update Table1 " & _
    "set Password= '" & Text2.Text & "'" & _
    "where Password= '" & Text1.Text & "'"
    rs.Open sql, cn, adOpenStatic, adLockOptimisti c


    cn.BeginTrans
    cn.Execute sql
    cn.CommitTrans


    cn.Close
    MsgBox "password has been changed successfully"
    End Function

    Private Sub Command1_Click( )
    Call pass
    End Sub

    [/code]
    compiler error: expected a function or variable in "cn.open="" "line.am using vb6.0 as front end and database is Ms Access with ADODC..
    Last edited by debasisdas; Oct 24 '07, 09:29 AM. Reason: Formated using code tags.
  • shrimant
    New Member
    • Sep 2007
    • 48

    #2
    [code=vb]Private Function pass() As Boolean
    Dim cn As New ADODB.Connectio n
    Dim sql As String

    cn.Open "provider=micro soft.jet.OLEDB. 4.0;Data source=F:\icici \database.mdb;P ersist security info=true"

    sql = "update Table1 " & _
    "set Password= '" & Text2.Text & "'" & _
    " where Password= '" & Text1.Text & "'"
    cn.Execute(sql)
    cn.Close
    Set cn = Nothing
    MsgBox "password has been changed successfully"
    End Function

    Private Sub Command1_Click( )
    Call pass
    End Sub
    [/code]
    Please make sure to insert some spaces before the where clause and remove the "=" sign in cn.open
    Last edited by debasisdas; Oct 24 '07, 09:31 AM. Reason: Formatted using code tags

    Comment

    • rekhasc
      New Member
      • Oct 2007
      • 66

      #3
      [code=vb]Private Function pass() As Boolean
      Dim cn As New ADODB.Connectio n
      Dim sql As String

      cn.Open "provider=micro soft.jet.OLEDB. 4.0;Data source=F:\icici \database.mdb;P ersist security info=true"

      sql = "update Table1 " & _
      "set Password= '" & Text2.Text & "'" & _
      " where Password= '" & Text1.Text & "'"
      cn.Execute(sql)
      cn.Close
      Set cn = Nothing
      MsgBox "password has been changed successfully"
      End Function
      [/code]



      when i run d prog its giving error
      could not find installable ISAM.....
      can any one help me plz
      Last edited by debasisdas; Oct 24 '07, 09:32 AM. Reason: Foramtted using code tags.

      Comment

      • debasisdas
        Recognized Expert Expert
        • Dec 2006
        • 8119

        #4
        Find details regarding the topic here.

        Comment

        • rekhasc
          New Member
          • Oct 2007
          • 66

          #5
          Originally posted by debasisdas
          Find details regarding the topic here.


          i am using access 2007 is this the reason for that error ....
          if any changes required for access 2007...

          Comment

          • debasisdas
            Recognized Expert Expert
            • Dec 2006
            • 8119

            #6
            Originally posted by rekhasc
            i am using access 2007 is this the reason for that error ....
            if any changes required for access 2007...
            follow the first few searched links in the provided link for the reply.

            Comment

            • shrimant
              New Member
              • Sep 2007
              • 48

              #7
              Originally posted by rekhasc
              i am using access 2007 is this the reason for that error ....
              if any changes required for access 2007...

              If it it Access 2007 I beleive the connection string should be:

              "Provider=Micro soft.ACE.OLEDB. 12.0;Data Source=F:\icici \database.mdb;P ersist Security Info=False"

              But I seriously doubt because the Access 2007 file have an extension .accdb where as you file has a .mdb extension which tells that you are still using a Access 2000 thru 2003 file.

              So I am in the impression that you do not have all the Microsoft data access components, please download the latest MDAC from:


              Before making any code changes.

              Comment

              • Amit Chaudhary
                New Member
                • Sep 2013
                • 1

                #8
                ' set a password to a existing database in vb6...



                dim db as database

                Set db = OpenDatabase(Ap p.Path & "\database.mdb" , True, False, ";pwd=" & false)

                db.newpassword "","Passwor d"




                ' change password


                dim db as database

                Set db = OpenDatabase(Ap p.Path & "\database.mdb" , True, False, ";pwd=" & "old_passwo rd")

                db.newpassword "old_password", "new_Passwo rd"

                Comment

                Working...