Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2005
    Posts
    74

    Unanswered: Problem with updates

    hi! can anybody please help me with this problem. Currently i have the code below
    [VBCODE]
    StrSQL = "update users set username='" & UCase(txtUserChange.Text) & "',password='" & _
    new_pswrd & "',admin_user='" & UCase(chkchange.Value) & "' where username='" & _
    UCase(txtUserChange.Text) & "' and password='" & current_pswrd & "'"
    MsgBox StrSQL, vbOKOnly
    oConn.Execute (StrSQL)
    [/VBCODE]

    as you can see the code doesn't check if it updated my databses successfuly..i hope you have now idea what my problem is..my question is how will i check if it successfuly updated my databse or not. thanks in advance!!!

  2. #2
    Join Date
    Mar 2004
    Location
    Pakistan
    Posts
    31

    Unhappy

    Hi
    Use the optional parameter RecordsAffected

    connection.Execute CommandText, RecordsAffected, Options

    You can check it as
    for example

    dim intAffectedRec as long
    sql= Select * from tblUsers Where userName = 'Guest' and Passwrod='Guest'

    adoCn.Execute sql, intAffectedRec

    if intAffected>0 then
    Msgbox "Records Successfully update"
    else
    Msgbox "No Record upadted."
    end if

    I hope that It 'll help you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •