Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Help with results Table

Posted on 2004-11-18
9
Medium Priority
?
253 Views
Last Modified: 2008-03-06
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
            
      
0
Comment
Question by:dtolo
  • 5
  • 3
9 Comments
 
LVL 14

Expert Comment

by:huji
ID: 12615671
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
 
LVL 2

Author Comment

by:dtolo
ID: 12616266
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
 
LVL 2

Author Comment

by:dtolo
ID: 12616340
is it something like objrs.contact ? or objrs.email?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 2

Author Comment

by:dtolo
ID: 12616455
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
 
LVL 11

Accepted Solution

by:
sciber_dude earned 2000 total points
ID: 12617034
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
 
LVL 2

Author Comment

by:dtolo
ID: 12617115
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
 
LVL 2

Author Comment

by:dtolo
ID: 12617247
Targetpopulation and description are text fields, what do I have to do to make them display?
0
 
LVL 11

Expert Comment

by:sciber_dude
ID: 12617607
> 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
 
LVL 11

Expert Comment

by:sciber_dude
ID: 12617618
Also, you might not be displaying the correct address. look into that and let me know.

:) SD
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses

577 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question