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 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jul 2004
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    how can i display the data in group heading from 2 table?

    this code work
    but how can i display the data in group heading of department from 2 table?
    thanks
    asp beginner

    <html>
    <head>
    <title>display in department group heading</title>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-874">
    <link rel="STYLESHEET" type="text/css" href="style.css">
    </head>
    <body>
    <%
    Set Conndb = Server.createObject("ADODB.Connection")
    Conndb.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="& Server.MapPath("/../db/recruit.mdb")
    Sql = "SELECT * FROM recruit,Department WHERE recruit.DepartmentID = Department.DepartmentID"
    Set Rs = Server.CreateObject("ADODB.Recordset")
    Rs.Open Sql, Conndb,1,3
    %>
    <table border=1>
    <% Do While Not Rs.Eof %>
    <tr>
    <td colspan=2><center><%=Rs("DepartmentT")%></center></td>
    </tr>
    <tr>
    <td colspan=2><center><%=Rs("Department.DepartmentID")%></center></td>
    </tr>
    <tr>
    <td colspan=2><center><%=Rs("recruit.DepartmentID")%></center></td>
    </tr>
    <tr>
    <td ><%=Rs("NameT")%></td>
    <td ><%=Rs("qualification")%></td>
    </tr>
    <%Rs.MoveNext
    Loop %>
    <%Rs.Close
    set Rs = Nothing%>
    </table>
    </body>
    </html>
    <%
    Conndb.Close
    Set Conndb = Nothing
    %>

  • #2
    Regular Coder
    Join Date
    Jul 2004
    Posts
    173
    Thanks
    0
    Thanked 0 Times in 0 Posts
    what do you mean?

    do you want to sort the data by the heading department?

    be more precise!
    Web and Business Development from Cornwall - Startbar.co.uk

  • #3
    New to the CF scene
    Join Date
    Jul 2004
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile i mean that how to write asp code for displaying the data in groupof department

    i mean that
    how to write asp code for displaying the data in group heading of department like this

    department_a
    1.name1a qualification1a
    2.name2a qualification2a
    3.name3a qualification3a
    4.name4a qualification4a
    ....
    ....
    9.name9a qualification9a

    department_b
    1.name1b qualification1b
    2.name2b qualification2b
    ....
    ....
    ....
    25.name25b qualification25b
    department_c
    1.......
    2......
    3......

    thanks

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    What you want to do seems obvious to those of us who were coding on mainframes when paper reports were the preferred medium .

    You need to declare and initialize (to an empty value) a variable to store the value of the department field. Then inside your loop you check to see if the value of that variable is equal to the value of the department field for the current database record. If they aren't the same (which they won't be the first time through the loop and any time the department changes) you execute code to set the variable to the new value of department and output the department line to your table.

    Does this make sense to you?
    Check out the Forum Search. It's the short path to getting great results from this forum.


  •  

    Posting Permissions

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