Results 1 to 2 of 2

Thread: Ugh midterms

  1. #1

    Ugh midterms

    I got a Visual basic midterm in an hour.. im gonna use this forum to attempt to type the code i have memorized and see how i do before i gotta go in all alone!

    -----------------------------------
    Private sub form_Click()

    dim manager as employees
    set manager = new employees

    dim employeeinfo as ADODB.recordset

    on error goto EH:

    employeeinfo = manager.lookupemployeebyid(empid.text)

    Textbox1 = employeeinfo("field1")
    Textbox2 = employeeinfo("field2")

    normalexit:
    set employeeinfo = nothing
    set manager = nothing
    exit sub

    errorhandler:

    msgbox.err.description
    resume normalexit

    end sub
    -----------------------------------

    Private function LuookupemployeebyID (ByVal EmpID as string) as adodb.recordset

    dim Manager as employees
    set Manager = new Employees

    set LookupEmployeeByID = manager.Lookupemployeebyid(empid)
    set manager = nothing

    end function

    -----------------------------------

    Private Function lookupemployeebyID (ByVal EmpID as string) as adodb.recordset

    dim employeeinfo as adodb.recordset
    set employeeinfo = new adoadb.recordset

    pubs.cursorlocation = aduseclient

    dim pubs as new adodd.connection
    set pubs = new adodb.connection

    pubs.open "mydb"

    pubs.errors.clear

    set employeeinfo = pubs.execute("lookupemployeebyid' " " ' " , , adcmdtext)

    if pubs.errors <>0 then
    dim errmsg as string
    dim adoerror as error

    for each error in pubs.errors

    errmsg = errmsg & ADOerror.description & VBclrf
    next

    err.raise VBobjecterror +1024, typename(me), errmsg

    end if

    set employeeinfo.activeconnection = nothing
    set lookupemployeebyid = employeeinfo
    set employeeinfo = nothing
    pubs.close
    set pubs = nothing

    End function

    -----------------------------------------------


    I managed to memorize all that though im not sure its all correct. Wish me luck!

  2. #2
    Hugs to you, I hope it went well

    lilnymph
    Lilnymph - Clan Fixer - RK1
    lilnymph wrote on November 21st, 2003 08:01:01:
    You may take our postcount threads, but you will never take our FREEDOM!!!!!
    Originally posted by Cz
    The post count is mine! All mine! Mwahahahah!

    40.476190476190474% of me is a huge nerd! How about you?
    Style over Substance

Posting Permissions

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