Wrox Programmer Forums
|
ASP Forms As of Oct 5, 2005, this forum is now locked. Please use "Classic ASP beginner" at http://p2p.wrox.com/forum.asp?FORUM_ID=54 or "Classic ASP Professional" http://p2p.wrox.com/forum.asp?FORUM_ID=56 instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Forms section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 4th, 2004, 09:22 AM
Authorized User
 
Join Date: Jun 2004
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
Default Need some help

Hi

I have 2 problems I am dealing with.! I am paging through recodset but the data isn't align with my title. How can I correct that problem? 2) How can I make the tickect number and display as a link?
Once I have that completed I can have them display the data on another page.

I am new to asp any help is greatly appreciated.

Thanks

R.M



code:
Eta Call back Database


Ticket Number Status First Name Last Name Phone Number Account Number Customer Comment





Code:

<% @LANGUAGE = VBScript %>
<%Option Explicit
Response.Expires = 0
Const adOpenStatic = 3
Const adLockReadOnly = 1
Const adCmdText = &H0001

%>


<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Eta Call back Database</title>
</head>

<body>

<p align="center">Eta Call back Database</p>
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<%
Dim objConn, objRS, strQ, objProp
Dim strconnection


Dim iPageSize
Dim iPageCount
Dim iPageCurrent
Dim strOrderBy
Dim strSQL
Dim objPagingConn
Dim objPagingRS
Dim iRecordsShown
Dim iFieldCount
Dim iRecordCount
Dim LoopRecordCount
Dim pageNum
Dim counter
Dim markShowPage
Dim I, J


iPageSize = 6

If Request.QueryString("page") = "" Then
    iPageCurrent = 1
Else
    iPageCurrent = CInt(Request.QueryString("page"))
End If

strSQL ="SELECT * from Escalation_Forms order by Ticket_Number asc;"



Set objPagingConn = Server.CreateObject("ADODB.Connection")
strConnection = "Provider=sqloledb;Data Source=FLMIRSQL02;"
strConnection = strConnection & "User ID=Source_Forms_User;Password=password;"
objPagingConn.Open strConnection

Set objPagingRS = Server.CreateObject("ADODB.Recordset")
objPagingRS.PageSize = iPageSize
objPagingRS.CacheSize = iPageSize

objPagingRS.Open strSQL, objPagingConn, adOpenStatic, adLockReadOnly, adCmdText

iPageCount = objPagingRS.PageCount
iFieldCount = objPagingRS.Fields.Count
iRecordCount = objPagingRS.RecordCount

If iPageCurrent > iPageCount Then iPageCurrent = iPageCount
If iPageCurrent < 1 Then iPageCurrent = 1

If iPageCount = 0 Then
    Response.Write "No records found!"
Else
    objPagingRS.AbsolutePage = iPageCurrent

Dim arrDBData
    ReDim arrDBData(iFieldCount, iRecordCount)
    LoopRecordCount = 0

    'arrDBData = objPagingRS.GetRows()

    Do While LoopRecordCount < iPageSize And Not objPagingRS.EOF
        For I = 0 To objPagingRS.Fields.Count - 1
            arrDBData(I, LoopRecordCount) = objPagingRS.Fields(I)
        Next
        LoopRecordCount = LoopRecordCount + 1
        objPagingRS.MoveNext
    Loop

    objPagingRS.Close
    Set objPagingRS = Nothing
    objPagingConn.Close
    Set objPagingConn = Nothing
End If

iRecordCount = iRecordCount - 1
iFieldCount = iFieldCount - 1
LoopRecordCount = LoopRecordCount - 1

pageNum = Round(iRecordCount/iPageSize)
If pageNum < (iRecordCount/iPageSize) Then pageNum = pageNum + 1

Response.Write "&nbsp;&nbsp;<b>Page: "
For counter = 1 To pageNum
    if counter=iPageCurrent then
        Response.Write "&nbsp;<span class=activepage>&nbsp;"
        Response.Write counter
        Response.Write "&nbsp;</span>"
        markShowPage=1
    else
        Response.Write "&nbsp;<a onclick=exitoff() href=Eta_database.asp?page="
        Response.Write counter
        Response.Write " class=listingLink>"
        Response.Write counter
        Response.Write "</a>"
    end if
Next
Response.Write "</b>"

Response.Write "&nbsp;&nbsp;"

Response.Write "<b>"

Response.Write "<a href=Eta_database.asp?page="
If iPageCurrent = 1 Then
    Response.Write pageNum
else
    Response.Write iPageCurrent-1
end if
Response.Write " class=listingLink>Back</a>&nbsp;&nbsp;"
Response.Write "<a href=Eta_database.asp?page="
If iPageCurrent = pageNum Then
    Response.Write "1"
else
    Response.Write iPageCurrent+1
end if
Response.Write " class=listingLink>Next</a>"

Response.Write "</b>"

%>


<table border="1">
<%
For I = 0 To LoopRecordCount
    Response.Write "<tr>" & vbCrLf
    For J = 0 To ifieldCount
        Response.Write vbTab & "<td>" & arrDBData(J, I) & "</td>" & vbCrLf
    Next ' J
    Response.Write "</tr>" & vbCrLf
Next ' I
%>
</table>
<style>

body {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}

td {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}

listingLink {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
color: blue;
text-decoration:none;
margin-left:0px;
margin-right:0px;
}

a.listingLink:hover {
color:#FF0000;
}

activepage {
color:#ffffee;
background-color: #000033;
font-weight: bold;
}
</style>




 
Old July 4th, 2004, 10:24 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Unfortunately, I do not understand both of your questions. What do you mean with "the data isn't align with my title"?
And where does the ticket number come from? From the recordset? Where do you want to link to?

If you elaborate a bit about what you're trying to accomplish, we might be able to help.

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old July 4th, 2004, 12:28 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

1) AFAICS, You don't display the TILES within <Table>
Ticket Number Status First Name Last Name Phone Number Account Number Customer Comment

You have not initialized the arrDBData array, which seems to be commented.
'arrDBData = objPagingRS.GetRows()
I wonder, if you are still able to see the records displayed.

Also why do you have to use vbCrLf and vbTab when you use TABLE tags? That too you are using them outside the <TD> tags. That should also be reason for not getting you data indented properly for the corresponding titles.

I would recommend you to have clear knowledge about using HTML tags like <TABLE>, <TR> and <TD>.

2) As you are using J and I as recordset array subscripts, I am not sure which subscript refers to TICKETNUMBER. So I cannot suggest you on that.

Cheers!

_________________________
- Vijay G
Strive for Perfection
 
Old July 6th, 2004, 08:11 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hello,

The browser will ignore the vbCrLf and vbTab anyway, so that is why it won't space correctly. Do what Vija recommends, use a table; best way to align the content.

For the ticket number, write out:

Response.Write("<a href='somelink.asp?ticket=" & objRS("TicketNumber") & "'>" & objRS("TicketNumber") & "</a>")

That will output a link for the ticket number.

Brian









Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.