Results 1 to 6 of 6
  1. #1

    Default Visual Basic Database Management


    Pls. help me how to code in changing the account using your old password replacing a new password with match to all datas in database? Unsaon man pghimu sa dtpicker nga dili xa pwede ka click sa niagi nga dates?

  2. #2

    Default Re: Visual Basic Database Management

    i'm not an expert but let me try. concept lang ni ha. this may vary a little sa actual codes.

    DTPicker:

    1. if you don't want to select a date later than the current date.

    Private Sub DTPicker1_Change()
    If DTPicker1.Value < Now Then
    MsgBox "You are not allowed to select previous dates.", vbInformation
    DTPicker1.Value = Now
    End If
    End Sub

    2. if you don't want to select previously selected dates then store it in your database for lookup (ikaw na balaha sa code).

    please elaborate your question on password thing kay medyo wa ko kasabot.

  3. #3

    Default Re: Visual Basic Database Management

    bro mao ra gyud ni ako ika hinabang nimu.

    Just text me if you have problem understanding the code and give me your landline so i can give you a detail explanation for the code.
    See the code below...

    '************************************************* **************************************
    ' Module : Form1
    ' DateTime : 10/18/2006 18:21
    ' Author : dlanyer77
    ' Purpose : for changing password
    '************************************************* **************************************

    Option Explicit

    Private strSQL As String
    Private Const SysInf As String = "System Information"

    Private Type MyValidation
    password As String
    passwordExist As Boolean
    End Type

    Private Sub cmdChangeNow_Click()
    Dim PwdConfirm As MyValidation
    On Error GoTo ErrHandler

    OracleDBConnect.BeginTrans

    If txtNewPassword.Text = txtNewPWordConfirm.Text Then
    PwdConfirm = PasswordConfirm(Currentuser.IDNumber)
    If PwdConfirm.passwordExist Then
    If PwdConfirm.password = txtCurrentPassword.Text Then
    strSQL = "UPDATE pass_lib " & _
    "SET password = '" & txtNewPassword.Text & "' " & _
    "WHERE idnumber = " & Currentuser.IDNumber
    OracleDBConnect.Execute strSQL
    MsgBox "Password changed!", vbInformation, SysInf
    Else
    MsgBox "Invalid password!", vbExclamation, SysInf
    End If
    End If
    Else
    MsgBox "New Password not match!", vbExclamation, SysInf
    End If
    OracleDBConnect.CommitTrans
    Exit Sub

    ErrHandler:
    OracleDBConnect.RollbackTrans
    MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure cmdChangeNow_Click of Form Form1", vbExclamation, SysInf
    Exit Sub
    End Sub

    Private Function PasswordConfirm(ByVal lngValue As Long) As MyValidation
    Dim rec As New ADODB.Recordset

    On Error GoTo ErrHandler

    strSQL = "SELECT password " & _
    " FROM pass_lib " & _
    " WHERE idnumber = " & lngValue
    rec.Open strSQL, OracleDBConnect

    If Not rec.EOF Then
    PasswordConfirm.passwordExist = True
    PasswordConfirm.password = rec!password
    Else
    PasswordConfirm.passwordExist = False
    End If
    rec.Close

    Set rec = Nothing
    Exit Function

    ErrHandler:
    MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure PasswordConfirm of Form Form1", vbExclamation, SysInf
    Exit Function
    End Function

  4. #4
    Senior Member
    Join Date
    Oct 2006
    Gender
    Male
    Posts
    524

    Default Re: Visual Basic Database Management

    Quote Originally Posted by aelleah
    Pls. help me how to code in changing the account using your old password replacing a new password with match to all datas in database? Unsaon man pghimu sa dtpicker nga dili xa pwede ka click sa niagi nga dates?
    dont expect me to explicitly solve ur problem hehe anyway here's some overview of some possible workaround:
    Changing account is easy:
    Consider you have this traditional format:

    Three textboxes:
    txtpass(1) is for Old password
    txtpass(2) is for New Password
    txtpass(3) is for Confirm New Password

    Commandbutton1 is for Update

    Code:
     Private Sub Commandbutton1_Click(Index As Integer)
    Select Case Index
      Case 0
        If txtPass(1).Text <> txtPass(2).Text Or txtPass(2).Text <> txtPass(1).Text Then
          MsgBox "<Confirm New Password> did not match with the <New Password> ", vbInformation, Me.Caption
          txtPass(2).SetFocus
          Exit Sub
         Else
          Call updatePass
         End If
      Case 1
        Unload Me
    End Select
    End Sub
    your callupdatepass may look like this:

    Code:
     Private Sub updatePass()
    Dim rs As New ADODB.Recordset
    Dim msg As String
    On Error GoTo err_Handler
    
     msg = MsgBox("Are you sure you want to modify this record?", vbYesNo)
     If msg = vbYes Then
         Set rs = cnSQL.Execute("update vfiuseraccess " & _
              "set username = '" & txtPass(4).Text & "'," & _
              "name = '" & txtPass(5).Text & "'," & _
              "passwrd = '" & Encrypt(txtPass(1).Text) & "'," & _
              "mrs = '" & txtPass(7).Text & "'," & _
              "mis = '" & txtPass(8).Text & "'," & _
              "users = '" & txtPass(9).Text & "'," & _
              "security = " & txtPass(6).Text & _
              " WHERE usercode = " & Val(txtPass(3).Text))
      MsgBox "Record was updated successfully  ", vbInformation, Me.Caption
      Unload Me
      rfrsh
     Else
       MsgBox "Cancel was selected ", vbInformation, Me.Caption
       Exit Sub
     End If
      Exit Sub
    err_Handler:
      MsgBox err.Description, vbInformation, Me.Caption
    End Sub
    for the datepicker problem for me i found it unlogical to solve bcoz datepicker usually serves as date filter's instead of pre empted conditions


  5. #5

    Default Re: Visual Basic Database Management

    @ebyong

    bro for me dili man necessary nga e set pa ang rs sa updatePass nga procedure kay pwede man nimu e execute directly also its a good practice to destroy the recordset before exit sub to release the object and to free-up the memory (thats vb code tuning). lastly, i think making a control array is not a good practice (vb code tuning again). share lang ko bro ha. peace!

  6. #6
    Senior Member
    Join Date
    Oct 2006
    Gender
    Male
    Posts
    524

    Default Re: Visual Basic Database Management

    Quote Originally Posted by dlanyer77
    @ebyong

    bro for me dili man necessary nga e set pa ang rs sa updatePass nga procedure kay pwede man nimu e execute directly also its a good practice to destroy the recordset before exit sub to release the object and to free-up the memory (thats vb code tuning). lastly, i think making a control array is not a good practice (vb code tuning again). share lang ko bro ha. peace!
    how sure you are hehe anyway this are just workaround no need to blow ur semantics for in the first place as i said i dont want to reiterate the solution of the problem at least im making a fairview of the scenario and also did u see my unload code for u to say that im not killing any recordset? anyway bro ur damned good i hope u could share some semantics for us to obey PEACE!

  7.    Advertisement

Similar Threads

 
  1. Need Visual Basic Programmer
    By artdoblas in forum Programming
    Replies: 8
    Last Post: 11-28-2007, 03:16 AM
  2. Visual Basic w/ Firebird
    By daryl in forum Software & Games (Old)
    Replies: 2
    Last Post: 05-20-2006, 11:26 AM
  3. how to use ADODC in Visual Basic
    By arbie_mon in forum Software & Games (Old)
    Replies: 0
    Last Post: 05-05-2006, 02:59 PM
  4. Replies: 12
    Last Post: 04-14-2006, 02:38 PM
  5. visual basic.net installer
    By zEmI in forum Software & Games (Old)
    Replies: 3
    Last Post: 09-14-2005, 07:24 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top