Guys
I have tried something but not sure if this is right.
It gives me this error
Microsoft VBScript runtime error '800a01fb'
An exception occurred: 'dbRS.Open'
/admin/man.asp, line 20
Someone please help
Regards
Jas
<%
set conn = Server.Createobject("ADODB.Connection")
conn.Provider = "Microsoft.Jet.OLEDB.4.0"
conn.Open "D:\Applications\Holidays12004\Includes\holidays.m db"
Getparents()
Function GetParents()
Set dbRS = Server.CreateObject("ADODB.Recordset")
' ADO code to load all the posts with a null parent
dbRS.Open "SELECT * FROM empprofile order by managername", conn
Do While Not dbRS.EOF
GetReplies(dbRS.Fields("empname"))
dbRS.MoveNext
Loop
End Function
Function GetReplies(parentID)
Set dbRS = Server.CreateObject("ADODB.Recordset")
dbRS.Open "SELECT * FROM empprofile WHERE managername = '" & parentid &
"'", conn
Do While Not dbRS.EOF
Response.write "mangername = " & dbRS.Fields("managername") & "
empname = " & dbRS.Fields("empname") & "<br>"
' <-- Your recursive call. Walks down each tree branch until
' it hits the last reply in a tree (dbRS returns no rows), then backs
out.
GetReplies(dbRS.Fields("empname"))
dbRS.MoveNext
Loop
End Function
%>
"Al" <jo*****@msn.com> wrote in message
news:OE*************@TK2MSFTNGP09.phx.gbl...
Group it as followed.
Dim iOldManagerNo as integer
Dim oEmpRs as RecordSet
Set oEmpRs = oConnection.OpenRecordSet("SELECT * FROM From Employee Order
By ManagerNo")
IF not oEmpRs.EOF
'- First Group.
Print ManagerNo Group
Do While oEmpRs.EOF
if oEmpRs!ManagerNo <> iOldManagerNo then
iOldManagerNo = oEmpRs!ManagerNo
Print ManagerNo Group
End if
Print EmpNo, Name
Loop
End if
oEmpRs.Close
Set oEmpRs = Nothing
Good Luck..!
"JP SIngh" <no**@none.com> wrote in message
news:ed**************@TK2MSFTNGP10.phx.gbl... Hi All
I am in a very tricky situation wonder if you anyone can help.
We have a table where we store employee information. One of the fields
in the table stores the manager number which is the employee number of the
users manager. Sample data is below
EmpNo Name ManagerNo
2211 Peter 9900
8899 James 9900
9900 Mel 9111
9901 Ian 9111
9111 Simon 9111
I want to able to display all the employees who report to a certain
manager and also all the employees who report to them
Something like
Simon
Ian
Mel
Peter
James
I am sure this can be done but I don't know how to do it recursively.
Can help guys?