Help with results Table

Ok experts,

I need some more help (go figure)

I have a page that I want to use to create a data base results table.

These are the ideas I have, but they are not carved in stone and I am very open to suggestions.

Let me know if I should continue this question and add points.

I have the beginings of a style sheet, it looks like this:

TABLE.MyTable
     {
          border-style: none;
          padding-left: 6;
          padding-right: 6;
          padding-top: 6;
          padding-bottom: 6;
          background-color: "#FFFFFF";
     }

TD.MyHeader
     {
          border-top-style: solid;
          border-top-width: 1px;
          background-color: "#F2ECE1";
          font-family: Tahoma;
          font-size: 12pt;
          font-weight: bold;
     }


TD.MyData
     {
          border-top-style: solid;
          border-top-width: 1px;
          font-family: Tahoma;
          font-size: 12pt;
     }



My ASP page so far looks like this:

<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Courts Served</title>
<LINK REL=stylesheet HREF="../css/asptable.css" TYPE="text/css">
<style fprolloverstyle>A:hover {color: #FF0000; font-family: Tahoma}
</style>
</head>

<body bgcolor="#0055AD">
<%
Dim varCourt, objConnection, strConnectString, strSQL, objRS
varCourt = request("Court")
strConnectString = "DRIVER={SQL Server};SERVER=appalachian\intrasql1;DATABASE=CSSD;UID=cssdUser;PWD=cs#sd4$xg"
set objConnection=Server.CreateObject("ADODB.Connection")
objConnection.ConnectionTimeout = 15
objConnection.CommandTimeout =  10
objConnection.Mode = 3 'adModeReadWrite
if objConnection.state = 0 then
     objConnection.Open strConnectString
end if
strSQL=     "SET NOCOUNT ON;" &_
               "SELECT * FROM dbo.Information WHERE (CourtsServed LIKE '%" & varCourt & "%')"

'response.write "strSQL: "&strSQL
'response.end

set objRS=objConnection.Execute(strSQL)


  Response.Write("<Table class=""MyTable"" id=""regtable"">")
  do while not objRS.EOF
       Response.Write("<TR>")
       for j=0 to objRS.Fields.count-1
            Response.Write("<TD class=""MyData"">" & objRS(j).Value & "</TD>")
           
       next
       Response.Write("</TR>")
       objRS.MoveNext
       loop
    Response.Write("</Table>")
%>



</body>

</html>


My database fields that I want to display are:

1      ProgramType
2      Contractor
3      ContractNumber
4      Discipline
5      ContractType
6      Contact
7      Email
8      TownCode      
9      Phone
10      Region
11      Slots
12      Accountant      
13      ComplianceSpecialist
14      Website
15      HoursOfOperation
16      ClientFees
17      Beds
18      Units      
19      CourtsServed
20      Description      
21      TargetPopulation

The thing is that I want to lay the table out more like this:

<table border="0" cellpadding="6" cellspacing="0" width="100%" bgcolor="#FFFFFF" id="table1">
      <tr>
            <td bgcolor="#C8C8D2" width="12%"><font face="Tahoma" size="2"><b>Type:</b></font></td>
            <td width="28%" bgcolor="#F2ECE1"><font face="Tahoma" size="2">
            Adolescent Clinical Treatment</font></td>
            <td bgcolor="#C8C8D2" width="10%"><font face="Tahoma" size="2"><b>
            Contract#:</b></font></td>
            <td width="46%" bgcolor="#F7EFE7"><font face="Tahoma" size="2">
            2226-04 (110ACT)</font></td>
      </tr>
      <tr>
            <td bgcolor="#C8C8D2" width="12%"><font face="Tahoma" size="2"><b>
            Contact:</b></font></td>
            <td width="28%" bgcolor="#F2ECE1"><font face="Tahoma" size="2">
            Jennifer Barnett</font></td>
            <td bgcolor="#C8C8D2" width="10%"><font face="Tahoma" size="2"><b>Email:</b></font></td>
            <td width="46%" bgcolor="#F7EFE7"><font face="Tahoma" size="2">
            <a href="mailto:jbarnett@wheelerclinic.org">
            jbarnett@wheelerclinic.org</a></font></td>
      </tr>
      <tr>
            <td bgcolor="#C8C8D2" width="12%"><font face="Tahoma" size="2"><b>
            Address</b></font></td>
            <td colspan="3" bgcolor="#F2ECE1"><font face="Tahoma" size="2">
            91 Northwest Drive&nbsp;&nbsp;
            Plainville&nbsp;
            CT,
            &nbsp;</font></td>
      </tr>
      <tr>
            <td bgcolor="#C8C8D2" width="12%"><font face="Tahoma" size="2"><b>Phone:</b></font></td>
            <td width="28%" bgcolor="#F2ECE1"><font face="Tahoma" size="2">
            (860) 793-4413</font></td>
            <td bgcolor="#C8C8D2" width="10%"><font face="Tahoma" size="2"><b>
            Region:</b></font></td>
            <td width="46%" bgcolor="#F7EFE7"><font face="Tahoma" size="2">
            Northern</font></td>
      </tr>
      <tr>
            <td bgcolor="#C8C8D2" width="12%"><font face="Tahoma" size="2"><b>
            Accountant:</b></font></td>
            <td width="28%" bgcolor="#F2ECE1"><font face="Tahoma" size="2">
            Cathy Jazwicz</font></td>
            <td bgcolor="#C8C8D2" width="10%"><font face="Tahoma" size="2"><b>
            Specialist:</b></font></td>
            <td width="46%" bgcolor="#F7EFE7"><font face="Tahoma" size="2">
            Robbie Prymula</font></td>
      </tr>
      <tr>
            <td bgcolor="#C8C8D2" width="12%"><font face="Tahoma" size="2"><b>Hours:</b></font></td>
            <td width="28%" bgcolor="#F2ECE1"><font face="Tahoma" size="2">
            M-Th 8-9 F 8-5 Sat 9-12 24 Availability.</font></td>
            <td bgcolor="#C8C8D2" width="10%"><font face="Tahoma" size="2"><b>Slots:</b></font></td>
            <td width="46%" bgcolor="#F7EFE7"><font face="Tahoma" size="2">
            20</font></td>
      </tr>
      <tr>
            <td bgcolor="#C8C8D2" width="12%"><font face="Tahoma" size="2"><b>
            Website:</b>&nbsp;</font></td>
            <td colspan="2" bgcolor="#F2ECE1"><font face="Tahoma" size="2">
            <a href="">
            &nbsp;</a></font></td>
            <td bgcolor="#C0C0C0" width="46%"><font face="Tahoma" size="2"><b>Beds:</b>&nbsp;<font color="#F2ECE1">0</font><b>&nbsp;
            Units:</b>&nbsp;<font color="#F2ECE1">0</font></font></td>
      </tr>
      <tr>
            <td bgcolor="#C8C8D2" width="12%"><font face="Tahoma" size="2"><b>
            Description:</b></font></td>
            <td colspan="3" bgcolor="#F2ECE1"><font face="Tahoma" size="2">
            Community-based treatment program offering highly individualized,  intensive individual and family therapy with a range of intensity from weekly outpatient services through brief in-patient hospitalization.</font></td>
      </tr>
      <tr>
            <td bgcolor="#9FA5BB" colspan="4">&nbsp;</td>
      </tr>
      <tr>
            <td bgcolor="#C8C8D2" width="12%"><font face="Tahoma" size="2"><b>
            Target:</b>&nbsp;</font></td>
            <td colspan="3" bgcolor="#F2ECE1"><font face="Tahoma" size="2">
            Juveniles facing or adjudicated for delinquency charges; who are on probation or non-judicial supervision; who meet diagnostic criteria for acute thought and mood disorders, chemical dependence, complicated grief, trauma reaction/response and PTSD, self injurious behavior/suicidal ideation; comorbidity of externalized and internalized pathologies; who are ineligible for HUSKY A or B or DCF's KidCare services, or who are waiting for HUSKY A or B or KidCare services, but require bridge services.</font></td>
      </tr>
</table>

I know I can est all the colr font attributes etc. in the style sheet.  But the layout where i have a label then the data field, that's the part I get hung up on.

Do I do something like:  "<tr><td class=""MyData"">"  & " Contact:" & "</td><td class=""MyData"">"  & @Contact "</td>" &_
            "<td class=""MyData"">"  & " Email:" <td class=""MyData"">" &_
                                "<a href=""mailto:"" & @Email "">"" & "</td></tr>"

In the loop?

Any advise help, questions and comments will be greatly appreciated.

~David
            
      
LVL 2
dtoloAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hujiCommented:
I'm not sure if I've got your question well, but I think you are looking for a way so that the "Contact:" part and the "@contact" value look different in font/color/etc , when they are all dynamically created. If so, then you may do it this way:

"<tr><td class=""MyHeader"">"  & " Contact:" & "</td><td class=""MyData"">"  & @Contact "</td>" &_
          "<td class=""MyHeader"">"  & " Email:" </td><td class=""MyData"">" &_
                                "<a href=""mailto:"" & @Email "">"" & "</td></tr>"


and then set the background color for MyHeader to #C8C8D2 and for MyData to #F2ECE1. Something like this:

TD.MyHeader
     {
          border-top-style: solid;
          border-top-width: 1px;
          background: #C8C8D2;
          font-family: Tahoma;
          font-size: 12pt;
          font-weight: bold;
     }


TD.MyData
     {
          border-top-style: solid;
          background: #F2ECE1;
          border-top-width: 1px;
          font-family: Tahoma;
          font-size: 12pt;
     }

Wish I can help
Huji
0
dtoloAuthor Commented:
I understand how to do that.


My question is much more complicated.

I want to be able to position and adjust the data in the table rows and colums. the part that I am having troulble with is the loop.  How do I specify in the loop which field goes where.  I would also like to know how to make the field a hyperlink.
0
dtoloAuthor Commented:
is it something like objrs.contact ? or objrs.email?
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

dtoloAuthor Commented:
I am getting this error:

Microsoft VBScript compilation error '800a03ea'

Syntax error

/cssd/contractors/csASPonly.asp, line 42

from this piece of code:

  Response.Write("<Table class=""MyTable"" id=""regtable"">")
  do while not objRS.EOF
       Response.Write("<TR>")
       for j=0 to objRS.Fields.count-1
            Response.Write("<tr><td class=""MyData"">"  & " Contact:" &_
            "</td><td class=""MyData"">"  & objRS.Contact & "</td>" &_
          "<td class=""MyData"">"  & " Email: <td class=""MyData"">" &_
                                "<a href=""mailto:"" & objRS.Email & "">"" & "</td>" & "</tr>")
           
       next
       Response.Write("</TR>")
       objRS.MoveNext
       loop
    Response.Write("</Table>")
%>
 refering to this line:

"<a href=""mailto:"" & objRS.Email & "">"" & "</td>" & "</tr>")


0
sciber_dudeCommented:
Try this.. and post any errors you have received.

1. Make the changes to the .css file.
2. Copy the ASP as a different file and test it.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
Start CSS file:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
TABLE.MyTable
     {
          border-style: none;
          padding-left: 6;
          padding-right: 6;
          padding-top: 6;
          padding-bottom: 6;
          background-color: "#FFFFFF";
     }

TD.MyHeader
     {
          border-top-style: none;
          background-color: "#C8C8D2";
          font-family: Tahoma;
          font-size: 12pt;
          font-weight: bold;
     }


TD.Separator
     {
          border-top-style: none;
          background-color: "#9FA5BB";
     }

TD.MyData1
     {
          border-top-style: none;
        background-color: "#F2ECE1";          
        font-family: Tahoma;
          font-size: 12pt;
     }

TD.MyData2
     {
          border-top-style: none;
        background-color: "#C0C0C0";
        font-family: Tahoma;
          font-size: 12pt;
     }

FONT.MyData3
     {
        color: "#F2ECE1";
        font-family: Tahoma;
          font-size: 12pt;
     }

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
End CSS file:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
Start ASP file:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`

<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Courts Served</title>
<LINK REL=stylesheet HREF="../css/asptable.css" TYPE="text/css">
<style fprolloverstyle>A:hover {color: #FF0000; font-family: Tahoma}
</style>
</head>

<body bgcolor="#0055AD">
<%
Dim varCourt, objConnection, strConnectString, strSQL, objRS
varCourt = request("Court")
strConnectString = "DRIVER={SQL Server};SERVER=appalachian\intrasql1;DATABASE=CSSD;UID=cssdUser;PWD=cs#sd4$xg"
set objConnection=Server.CreateObject("ADODB.Connection")
objConnection.ConnectionTimeout = 15
objConnection.CommandTimeout =  10
objConnection.Mode = 3 'adModeReadWrite
if objConnection.state = 0 then
     objConnection.Open strConnectString
end if
strSQL=     "SET NOCOUNT ON;" &_
               "SELECT * FROM dbo.Information WHERE (CourtsServed LIKE '%" & varCourt & "%')"

set objRS=objConnection.Execute(strSQL)


do until objRS.EOF %>


<table class="MyTable" width="100%" id="table1">
     <tr>
          <td class="MyHeader" width="12%">Type:</td>
          <td class="MyData1" width="28%"><%=objRS("ProgramType")%></td>
          <td class="MyHeader" width="10%">Contract#:</td>
          <td class="MyData1" width="46%"><%=objRS("ContractNumber")%></td>
     </tr>
     <tr>
          <td class="MyHeader" width="12%">Contact:</td>
          <td width="28%" class="MyData1"><%=objRS("Contact")%></td>
          <td class="MyHeader" width="10%">Email:</td>
          <td width="46%" class="MyData1"><a href="mailto:<%=objRS("Email")%>"><%=objRS("Email")%></a></td>
     </tr>
     <tr>
          <td class="MyHeader" width="12%">Address</td>
          <td colspan="3" class="MyData1"><%=objRS("TownCode")%></td>
     </tr>
     <tr>
          <td class="MyHeader" width="12%">Phone:</td>
          <td width="28%" class="MyData1"><%=objRS("Phone")%></td>
          <td class="MyHeader" width="10%">Region:</td>
          <td width="46%" class="MyData1"><%=objRS("Region")%></td>
     </tr>
     <tr>
          <td class="MyHeader" width="12%">Accountant:</td>
          <td width="28%" class="MyData1"><%=objRS("Accountant")%></td>
          <td class="MyHeader" width="10%">Specialist:</td>
          <td width="46%" class="MyData1"><%=objRS("ComplianceSpecialist")%></td>
     </tr>
     <tr>
          <td class="MyHeader" width="12%">Hours:</td>
          <td width="28%" class="MyData1"><%=objRS("HoursOfOperation")%></td>
          <td class="MyHeader" width="10%">Slots:</td>
          <td width="46%" class="MyData1"><%=objRS("Slots")%></td>
     </tr>
     <tr>
          <td class="MyHeader" width="12%">Website:&nbsp;</td>
          <td colspan="2" class="MyData1"><a href="<%=objRS("Website")%>"><%=objRS("Website")%></a></td>
          <td class="MyData2" width="46%">
            Beds:&nbsp;<font class="MyData3"><%=objRS("Beds")%></font>&nbsp;
            Units:&nbsp;<font class="MyData3"><%=objRS("Units")%></font>
        </td>
     </tr>
     <tr>
          <td class="MyHeader" width="12%">Description:</td>
          <td colspan="3" class="MyData1"><%=objRS("Description")%></td>
     </tr>
     <tr>
          <td class="Separator" colspan="4">&nbsp;</td>
     </tr>
     <tr>
          <td class="MyHeader" width="12%">Target:&nbsp;</td>
          <td colspan="3" class="MyData1"><%=objRS("TargetPopulation")%></td>
     </tr>
</table>

<%
  objRS.MoveNext
loop

' Close up
objRS.close
set objRS = nothing

objConnection.close
set objConnection=Nothing
%>
</body>
</html>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
End ASP file:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dtoloAuthor Commented:
That makes it easy.  I did not realize that you could exit a loop like that.. go back to html.. and then jump right back in the loop.. Nice!!
0
dtoloAuthor Commented:
Targetpopulation and description are text fields, what do I have to do to make them display?
0
sciber_dudeCommented:
> Targetpopulation and description are text fields, what do I have to do to make them display?

Well this lines should take care of it.

<td colspan="3" class="MyData1"><%=objRS("Description")%></td>
<td colspan="3" class="MyData1"><%=objRS("TargetPopulation")%></td>

but did you mean that you wanted to format it, like retain the paragraphs etc?

To help me understand better, could u display what you are bring displayed now and what you want them to be?

:) SD
0
sciber_dudeCommented:
Also, you might not be displaying the correct address. look into that and let me know.

:) SD
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.