-
Oct 31st, 2002, 22:30:58
#1
Supa Leet
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!
-
Nov 1st, 2002, 11:51:23
#2
Hug-O-Doom
Hugs to you, I hope it went well
lilnymph
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules