Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: asp query

  1. #1
    New Coder
    Join Date
    May 2007
    Posts
    94
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy asp query

    hi..i need some help on wat the code i write as below.
    i m newbie in asp, so quite poor in the concept.

    COLOR="Navy"]
    Let say I have 2 type of leave type(annual leave and medical leave), then i set 2 type of balance leave in the DB (bannualleave,bmedicalleave)
    this two type of leave have thier own balance.wat i wan to do is...::
    *************************
    if leavetypeid="annual leave” then
    Balance=rsleave("BAnnualleave")
    NewBalance=Balance-totalday 'Totalday is the total leave emp apply

    elseif leavetypeid="medical leave" then
    Medical=rs("BMedicalLeave")
    NewMedicalBalance=Medical-totalday
    Else
    …..
    end if[/COLOR]

    after this if else statement, how can i update the column for bannualleave and bmedicalleave.i wan to do is if the leave type is annual leave then update the bannualleave in the table else if the leave type is medical leave then update the bmedicalleave in the table.do i need to write 2 query or got any other better solution?

    strupdate="UPDATE leaverecord Set BAnnualleave='"&NewBalance&"' WHERE empid=" &empid


    i hope can get form you all soon.i need to solve this problem ...
    thank you.

  • #2
    Senior Coder Spudhead's Avatar
    Join Date
    Jun 2002
    Location
    London, UK
    Posts
    1,856
    Thanks
    8
    Thanked 110 Times in 109 Posts
    run the update INSIDE the if/else?

  • #3
    New Coder
    Join Date
    May 2007
    Posts
    94
    Thanks
    0
    Thanked 0 Times in 0 Posts
    hi Spudhead , thank you for ur kind response.
    i have solve this problem.
    again, thank you very much.


  •  

    Posting Permissions

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