Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases 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 8th, 2004, 08:59 AM
Authorized User
 
Join Date: Jun 2004
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
Default helph with search n disp on result to link

Hi;
I am a little stuck and need some guidance. I have two question! in my code I
would like to include a drop down that will filter my database or do query then
have it display. 2) Have the tickect number displays as hyperlink so I can have
the users update part on the datbase. I believe I have to change the code to a
string in order to display the ticket number as link right? because I have them
display as a variable. Here's code: By the please reply back at
[email protected]

<% @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 = 4

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

strSQL ="SELECT ticket_Number, Time_Stamp, Status, Entity, Account_Number,
Escalation_Type, Cae_Name, Supervisor_Name, Lan, First_Name, Last_Name,
Phone_Number, Job_Number, Tech_Number, Cust_Com, Wip_Com from Escalation_Forms
ORDER BY Ticket_Number DESC;"



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">
        <tr>
            <th bgcolor="#99CCFF">Ticket
Number</th>
            <th width="37" bgcolor="#99CCFF">Date &
Time</th>
            <th bgcolor="#99CCFF">Status</th>
            <th bgcolor="#99CCFF">System</th>
            <th bgcolor="#99CCFF">Account
Number&nbsp; </th>
            <th bgcolor="#99CCFF">Escalation
Type</th>
            <th bgcolor="#99CCFF">Cae's
Name</th>
            <th bgcolor="#99CCFF">Supervisor's
Name&nbsp; </th>
            <th bgcolor="#99CCFF">Language</th>
            <th bgcolor="#99CCFF">First
Name</th>
            <th bgcolor="#99CCFF">Last Name&nbsp;
</th>
            <th bgcolor="#99CCFF">Phone
Number</th>
            <th bgcolor="#99CCFF">Tech
Number</th>
            <th bgcolor="#99CCFF">Job Number&nbsp;
</th>
            <th bgcolor="#99CCFF">Cust /
Comment</th>
            <th bgcolor="#99CCFF">Feed
Back</th>

        </tr>


<%
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 8th, 2004, 09:13 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

You may have to change how you output the records, to something like:

do while (not objRS.EOF)
  Response.Write("<tr><td><a href=""ticket.asp?ticket=" & objRS("Ticket_Number") & """>" & objRS("Ticket_Number") & "</a></td>")
  '..write rest of content here in this manner or by looping through it.

  objRS.MoveNext
loop

That's how you write the ticket number as a link. I don't know where you want it to redirect to, but that's how you achieve that.

For the filtering, you probably have to have it post back to the server to filter the response. You can do that, but I've never done it in ASP (in .NET it is pretty easy to do). I'm sure it can't be that hard.

Brian
 
Old July 8th, 2004, 09:23 AM
Authorized User
 
Join Date: Jun 2004
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you! I 'll try it now.

Ralph

 
Old July 8th, 2004, 01:13 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Calibus,

I would suggest you not to post the entire code in your posts, as it looks cluttered and would take away the inters from the one who reads it, seeing it too long. It would be better if you could post the relevant part of the code and leave some message about the errors you see and if reference to some line number needed can also mark that line with some color code there.

Cheers!

_________________________
- Vijay G
Strive for Perfection





Similar Threads
Thread Thread Starter Forum Replies Last Post
Paging for the search result ssvas BOOK: Beginning SharePoint 2007: Building Team Solutions with MOSS 2007 ISBN: 978-0-470-12449-9 0 November 27th, 2008 03:02 AM
code for disp the list of files seemantinibhosale BOOK: Beginning ASP 3.0 1 November 11th, 2008 01:44 PM
Search Result batott ASP.NET 2.0 Professional 1 June 5th, 2008 08:39 AM
Display Search Engine result in table using JSP sbc789 JSP Basics 3 December 3rd, 2007 11:35 PM
how to search on multiple sites and showing result cyberviral Classic ASP Basics 0 March 23rd, 2004 09:08 AM





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