Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display data across two lines instead of one

Status
Not open for further replies.

andyfresh

Technical User
Oct 4, 2005
33
GB
Hi,
Im currently working on a simple collect data from SQL and display, however im having problems with displaying the data. As you can see by the script it returns the data and displays it along one line in a table. Is there any way of returning the data and spreading it over two lines, so that it fits within a single screen??

Regards

Andy


<SCRIPT LANGUAGE=javascript>
<!--
SetPageTitle('Order Search')
//-->
</SCRIPT>

<%
Response.Write "<table width=""95%"" border=0 FRAME=Box RULES=none BORDERCOLOR=#666699 cellpadding=3 cellspacing=0 align=left>"
Response.Write "<TR><TD align=left width=15% valign=top >"
%>


<TABLE WIDTH=100% BORDER=0 CELLSPACING=0 CELLPADDING=2 >
<TR>
<TD NOWRAP width=1%></TD>
<TD NOWRAP width=98% bgcolor=#666699><FONT FACE="VERDANA" ><FONT color=#ffffff><b><FONT size=1>
v3.1 - Order Search</FONT></b></FONT><BR><BR></TD>
<TD NOWRAP width=1%></TD>
</TR>
<TR>
<FORM action=ordersearch1.asp method=post name=Search>
<TD NOWRAP width=1%></TD>
<TD NOWRAP width=98% bgcolor=LightSteelBlue align=right>
<p align="left">Enter OrderNumber:&nbsp;&nbsp;<input type="text" name="search" size=30 id=search>&nbsp;&nbsp;&nbsp; <INPUT type="submit" value="Search >>" id=btnSearch name=btnSearch> </TD>
<TD NOWRAP width=1% align=right></TD>
</Form>
</TR>
<TR>
<TD NOWRAP width=1%></TD>
<TD bgcolor=#666699 height=1></TD>
<TD NOWRAP width=1% align=right></TD>
</TR>
<TR>
<TD NOWRAP width=1%></TD>
<TD bgcolor=PaleTurquoise width=98% height=1></TD>
<TD NOWRAP width=1% align=right></TD>
</TR>
<%If Request("search") = "" then
count = 5%>

<TR>
<TD NOWRAP width=1%></TD>
<TD width=98% >There are no results to display. Please enter your search criteria in the box provided above.</TD>
<TD NOWRAP width=1% align=right></TD>
</TR>
</Table></TD></TR></TABLE>

<%ELSE
Response.Write "</Table>"
Dim strCnnInvoices
Dim objConn
Dim objRs

Dim strSearch
strSearch = Trim(Request("search"))
'strSearch = Request.Form["Search"].Text;

strCnnInvoices = Application("****************")


Set objConn = Server.CreateObject ("adodb.connection")
objConn.Open strCnnInvoices
Set objRs = Server.CreateObject ("adodb.recordset")

objRs.CursorType = adOpenForwardOnly

SQL = "SELECT Distinct LiveOrderDetails.id, LiveOrderDetails.DatePlaced, LiveOrderDetails.Total, LiveOrderDetails.DateOpened, LiveOrderDetails.DateDispatched, LiveOrderDetails.RequestedDeliveryDate, LiveOrderContents.ProductID, LiveOrderContents.Quantity, LiveOrderContents.Unit, LiveOrderContents.Price, LiveOrderContents.ProductName, LiveOrderContents.InvoiceID, LiveOrderDetails.UserID, logins.login_first_name, logins.login_last_name, LiveOrderContents.CompanyID, OrganisationDetails.Name, LiveOrderDetails.WholesalerID, OrganisationDetails_1.Name AS Expr3, " &_
"UserHistory.UserHostName " &_
"FROM LiveOrderDetails INNER JOIN " &_
"LiveOrderContents ON LiveOrderDetails.id = LiveOrderContents.InvoiceID INNER JOIN " &_
"logins ON LiveOrderDetails.UserID = logins.login_id INNER JOIN " &_
"OrganisationDetails ON LiveOrderDetails.OutletID = OrganisationDetails.OrganisationID INNER JOIN " &_
"OrganisationDetails OrganisationDetails_1 ON LiveOrderDetails.WholesalerID = OrganisationDetails_1.OrganisationID INNER JOIN " &_
"UserHistory ON LiveOrderDetails.SessionID = UserHistory.SessionID " &_
"WHERE (LiveOrderContents.InvoiceID = '" + strSearch + "')"


'Response.Write SQL
Set objRs = objConn.Execute(SQL)

Response.Write "<TABLE WIDTH=98% BORDER=1 FRAME=Box RULES=none BORDERCOLOR=#b0c4de CELLSPACING=0 CELLPADDING=2 ALIGN=CENTER>" & VbCr
Response.Write "<TR BGCOLOR=#b0c4de>" & VbCr
Dim intTableColumnCount
intTableColumnCount = objRs.Fields.Count

Response.Write "<TD colspan=" & intTableColumnCount & "><table width=""80%"" border=0><B><FONT COLOR=#ffffff>Results For Order Number: '" + strSearch + "' </FONT></B></TD></table></td>"
count = 1

If NOT objRs.EOF and NOT objRs.BOF then
Response.Write "<TR BGCOLOR=#b0c4de>" & VbCr
For each x in objRs.Fields
Response.Write "<TD>" & x.name & "</td>"
next
Response.Write "</TR>" & VbCr

While Not objRs.EOF

if (count mod 2) = 1 then
Response.Write "<TR BGCOLOR=#ffffff>" & VbCr
Else
Response.Write "<TR BGCOLOR=#b0c4de>" & VbCr
End If

For each x in objRs.Fields
If IsNull(x.value) then
Response.Write "<TD>No Value</td>"
else
Response.Write "<TD>" & x.value & "</td>"
End If
next

Response.Write "</tr>"
count = count + 1
objRs.Movenext

WEnd
Response.Write "<tr><TD>End of data.</td></tr>"
Else
Response.Write "<TR BGCOLOR=#ffffff><TD>There is no data.</td></tr>"
End If
end if


%>
 
Try working backwards from HTML to ASP...

Make a plain static HTML page that has the desired layout and then work backwards from there to create ASP that generates this layout.
 
Yes, as far as I know the only data that really stretches a tables column with is data with no spaces such as a really long e-mail address.

And for a related link to make lots of short pieces of data fit on a screen better:

Classic ASP Design Tips - Multiple Records in Each Row


Best regards,
-Paul
- Freelance Web and Database Developer
- Classic ASP Design Tips
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top