beegled
asked on
Select menu in DB paging script
Hello,
I have borrowed the following script from another source:
% @ LANGUAGE="VBScript" %>
% Option Explicit %>
%
Response.Expires = 0
Response.Buffer = True
Server.ScriptTimeout = 360
Const adOpenForwardOnly = 0
Const adLockReadOnly = 1
Const adUseClient = 3
Const adCmdText = 1
Dim cmdDC, RecordSet, DataConnection, CommandText
DataConnection = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("demo.mdb")
Set cmdDC = Server.CreateObject("ADODB .Connectio n")
cmdDC.Open DataConnection
%>
html>
head>/head>
body>
%
Dim recPage, numPages, numRecs, pageSize
'Get the page number we need to display from QueryString
recPage = CInt(Request.Querystring(" page"))
If recPage=0 Then recPage=1
'Get the requested number of records per page
pageSize = CInt(Request.Querystring(" recs"))
If pageSize = 0 Then pageSize = 10 'If we aren't given a value use 10
'The code we need to set up a recordset object for paging
Set RecordSet = Server.CreateObject("ADODB .RecordSet ")
RecordSet.PageSize = pageSize
RecordSet.CacheSize = pageSize 'This is optional
RecordSet.CursorLocation = adUseClient
'Open the recordset
CommandText = "SELECT * FROM Table1"
RecordSet.Open CommandText, cmdDC, adOpenForwardOnly, adLockReadOnly, adCmdText
'Get the number of pages and records
numPages = RecordSet.PageCount
numRecs = RecordSet.RecordCount
'Just in case we have a bad request
If recPage > numPages Then recPage = numPages
If recPage 1 Then recPage = 1
'Set the page we want to display
RecordSet.AbsolutePage = recPage
'Write out the total number of records in the recordset
Response.Write("P> B>" & numRecs & " records found./B>" )
'Write out the current page number and total number of pages
Response.Write("BR> Page " & recPage & " of " & numPages & "/P>")
'Write out the records contained in this page
Dim i
For i=1 To pageSize
If NOT RecordSet.EOF Then
Response.Write(RecordSet(" Name") & " | " & RecordSet("Data") & " BR>")
RecordSet.MoveNext
End If
Next
'Clean up
RecordSet.Close
cmdDC.Close
Set RecordSet = Nothing
Set cmdDC = Nothing
%>
form name="recsform" action="paging.asp" method="get">
Show
select name="recs" onchange="updateBoxes(recs form)">
option value="10">10
option value="25">25
option value="50">50
option value="100">100
/select>
records per page
Display page
select name="page">
option>/option>
option>/option>
option>/option>
option>/option>
option>/option>
option>/option>
option>/option>
option>/option>
/select>
input type="submit" value="GO">
/form>
SCRIPT LANGUAGE="JavaScript">
!--
NUM_RECORDS = %=numRecs%>;
function updateBoxes(theFormObj)
{
var selectedRecs = theFormObj.recs.options[th eFormObj.r ecs.select edIndex].v alue;
var numpages = Math.ceil(NUM_RECORDS / selectedRecs);
var numOptions = theFormObj.page.length;
for(var i=0 ; inumOptions ; i++){
theFormObj.page.options[0] = null;
}
for(var j=0 ; jnumpages ; j++){
theFormObj.page.options[j] = new Option(j+1,j+1);
}
theFormObj.page.selectedIn dex = 0;
}
// -->
/SCRIPT>
SCRIPT LANGUAGE="JavaScript">
!--
updateBoxes(document.recsf orm);
// -->
/SCRIPT>
/body>
/html>
Basically, the problem I see with it is that in that second select menu named "page", there is no way to write "selected" to any of the options. For example, in the other slect menu named "recs", I have added the following to each option:
<option<% If pageSize = 10 Then Response.Write " selected" End If %> value="10">10</option>
Does anybody know of anything I could do that with that second menu. It seems to me that the select menus should "remember" your choices when you go to another page.
Any help is greatly appreciated. Thank you.
David
I have borrowed the following script from another source:
% @ LANGUAGE="VBScript" %>
% Option Explicit %>
%
Response.Expires = 0
Response.Buffer = True
Server.ScriptTimeout = 360
Const adOpenForwardOnly = 0
Const adLockReadOnly = 1
Const adUseClient = 3
Const adCmdText = 1
Dim cmdDC, RecordSet, DataConnection, CommandText
DataConnection = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("demo.mdb")
Set cmdDC = Server.CreateObject("ADODB
cmdDC.Open DataConnection
%>
html>
head>/head>
body>
%
Dim recPage, numPages, numRecs, pageSize
'Get the page number we need to display from QueryString
recPage = CInt(Request.Querystring("
If recPage=0 Then recPage=1
'Get the requested number of records per page
pageSize = CInt(Request.Querystring("
If pageSize = 0 Then pageSize = 10 'If we aren't given a value use 10
'The code we need to set up a recordset object for paging
Set RecordSet = Server.CreateObject("ADODB
RecordSet.PageSize = pageSize
RecordSet.CacheSize = pageSize 'This is optional
RecordSet.CursorLocation = adUseClient
'Open the recordset
CommandText = "SELECT * FROM Table1"
RecordSet.Open CommandText, cmdDC, adOpenForwardOnly, adLockReadOnly, adCmdText
'Get the number of pages and records
numPages = RecordSet.PageCount
numRecs = RecordSet.RecordCount
'Just in case we have a bad request
If recPage > numPages Then recPage = numPages
If recPage 1 Then recPage = 1
'Set the page we want to display
RecordSet.AbsolutePage = recPage
'Write out the total number of records in the recordset
Response.Write("P> B>" & numRecs & " records found./B>" )
'Write out the current page number and total number of pages
Response.Write("BR> Page " & recPage & " of " & numPages & "/P>")
'Write out the records contained in this page
Dim i
For i=1 To pageSize
If NOT RecordSet.EOF Then
Response.Write(RecordSet("
RecordSet.MoveNext
End If
Next
'Clean up
RecordSet.Close
cmdDC.Close
Set RecordSet = Nothing
Set cmdDC = Nothing
%>
form name="recsform" action="paging.asp" method="get">
Show
select name="recs" onchange="updateBoxes(recs
option value="10">10
option value="25">25
option value="50">50
option value="100">100
/select>
records per page
Display page
select name="page">
option>/option>
option>/option>
option>/option>
option>/option>
option>/option>
option>/option>
option>/option>
option>/option>
/select>
input type="submit" value="GO">
/form>
SCRIPT LANGUAGE="JavaScript">
!--
NUM_RECORDS = %=numRecs%>;
function updateBoxes(theFormObj)
{
var selectedRecs = theFormObj.recs.options[th
var numpages = Math.ceil(NUM_RECORDS / selectedRecs);
var numOptions = theFormObj.page.length;
for(var i=0 ; inumOptions ; i++){
theFormObj.page.options[0]
}
for(var j=0 ; jnumpages ; j++){
theFormObj.page.options[j]
}
theFormObj.page.selectedIn
}
// -->
/SCRIPT>
SCRIPT LANGUAGE="JavaScript">
!--
updateBoxes(document.recsf
// -->
/SCRIPT>
/body>
/html>
Basically, the problem I see with it is that in that second select menu named "page", there is no way to write "selected" to any of the options. For example, in the other slect menu named "recs", I have added the following to each option:
<option<% If pageSize = 10 Then Response.Write " selected" End If %> value="10">10</option>
Does anybody know of anything I could do that with that second menu. It seems to me that the select menus should "remember" your choices when you go to another page.
Any help is greatly appreciated. Thank you.
David
sorry!
if u r using a loop or an index replace the
if request.queryString("id")= 1
with
if request.queryString("id")= INDEX(like for index=1 to 20)
if u r using a loop or an index replace the
if request.queryString("id")=
with
if request.queryString("id")=
Here is how you do it:
<select name="page">
<%
For lngPage=1 to numPages
%><option value="<%=lngPage%>"<%If lngPage=recPage Then Response.Write " selected"%>><%=lngPage%><%
Next
%>
</select>
<select name="page">
<%
For lngPage=1 to numPages
%><option value="<%=lngPage%>"<%If lngPage=recPage Then Response.Write " selected"%>><%=lngPage%><%
Next
%>
</select>
ASKER
giladBoker,
I have tried your method and it did not work for me. Perhaps I did not do it correctly but it gave me JavaScript errors.
GreenGhost,
I tried your method but then the select menu was no longer populated with any values and the page stopped processing after that so any content I had below it did not show when the page was loaded as if I had a response.end in there or something.
David
I have tried your method and it did not work for me. Perhaps I did not do it correctly but it gave me JavaScript errors.
GreenGhost,
I tried your method but then the select menu was no longer populated with any values and the page stopped processing after that so any content I had below it did not show when the page was loaded as if I had a response.end in there or something.
David
check your scripts again.
generaly you just have to send an index of where u r and get it agin.
onchange-u send the index threw the url
and when the page is loaded u ask for this index from the url and then work with it.
shouldnt be so complicated
good luck
generaly you just have to send an index of where u r and get it agin.
onchange-u send the index threw the url
and when the page is loaded u ask for this index from the url and then work with it.
shouldnt be so complicated
good luck
ASKER
giladBoker,
I still have not figured exactly the problem I am having with the script you gave me but now realize am unable to use what you have given me. The problem is that I have modified the above script a great deal and in fact am not just writing data from a DB but allowing the user to query different sets of data from the DB and am using the get method.
David
I still have not figured exactly the problem I am having with the script you gave me but now realize am unable to use what you have given me. The problem is that I have modified the above script a great deal and in fact am not just writing data from a DB but allowing the user to query different sets of data from the DB and am using the get method.
David
Check the html source code created (view source) to check for any error messages. If you get an error in the code producing the select, the error message will not show on the page as it's inside the select.
You might have to dimension the counter:
Dim lngPage
I tried this, and it sure serves up a select list with pages 1 through 10, with 5 selected:
<%
Option Explicit
Dim numPages, recPage, lngPage
numPages=10
recPage=5
%>
<select name="page">
<%
For lngPage=1 to numPages
%><option value="<%=lngPage%>"<%If lngPage=recPage Then Response.Write " selected"%>><%=lngPage%><%
Next
%>
</select>
You might have to dimension the counter:
Dim lngPage
I tried this, and it sure serves up a select list with pages 1 through 10, with 5 selected:
<%
Option Explicit
Dim numPages, recPage, lngPage
numPages=10
recPage=5
%>
<select name="page">
<%
For lngPage=1 to numPages
%><option value="<%=lngPage%>"<%If lngPage=recPage Then Response.Write " selected"%>><%=lngPage%><%
Next
%>
</select>
do u have javascript error when u load the page??
if yes its beciuse that when u load page for the first time it comes without index at the url.
u should write in the action part of the form that goes to this form and index
example
=======
if your form name is myForm.asp
u go to the form that calls him and write in his action
<form name="what ever" action="MyForm.asp?id=1">
then u eliminate the error on the load part
if u have other errors please specify it over here
good luck
if yes its beciuse that when u load page for the first time it comes without index at the url.
u should write in the action part of the form that goes to this form and index
example
=======
if your form name is myForm.asp
u go to the form that calls him and write in his action
<form name="what ever" action="MyForm.asp?id=1">
then u eliminate the error on the load part
if u have other errors please specify it over here
good luck
giladBoker, check the code from beegled. It gets page number and page size from the querystring, and sets default values if there is no values, so there is no need to include the values when the page is first showed.
yes i see it now GreenGhost thanks..
ASKER
Here is what the script looks like now:
<% @ LANGUAGE="VBScript" %>
<% Option Explicit %>
<%
Response.Expires = 0
Response.Buffer = True
Server.ScriptTimeout = 360
Const adOpenForwardOnly = 0
Const adLockReadOnly = 1
Const adUseClient = 3
Const adCmdText = 1
Dim cmdDC, RecordSet, DataConnection, CommandText
DataConnection = "DRIVER=SQL Server;SERVER=server;DATAB ASE=db;UID =login;PWD =pass"
Set cmdDC = Server.CreateObject("ADODB .Connectio n")
cmdDC.Open DataConnection
Dim strProduct, strPart, strSort
strProduct = Request.Querystring("produ ct")
strPart = Request.Querystring("parts ")
strSort = Request.Querystring("sort" )
If strSort = "" Then
strSort = "COMPONENT_ITEM_NUMBER ASC"
Else If strSort = "numeric asc" Then
strSort = "COMPONENT_ITEM_NUMBER ASC"
Else If strSort = "numeric desc" Then
strSort = "COMPONENT_ITEM_NUMBER DESC"
Else If strSort = "alpha asc" Then
strSort = "COMPONENT_ITEM_DESCRIPTIO N ASC"
Else If strSort = "alpha desc" Then
strSort = "COMPONENT_ITEM_DESCRIPTIO N DESC"
End If
End If
End If
End If
End If
Dim aProducts
aProducts = Array("product1", "product2", "product3", "product4", "product5")
%>
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
function sortHandler(sort){
var URL = document.sort.site.options [document. sort.site. selectedIn dex].value ;
window.location.href = URL;
}
// -->
</SCRIPT>
</HEAD>
<BODY>
<p> </p>
<table border="0" cellpadding="3" cellspacing="0" width="100%">
<tr>
<td><font face="arial, helvetica" size="2"><b>Select Product</b></font></td>
<td colspan="2"><font face="arial, helvetica" size="2"><b>Select Parts Type</b></font></td>
<% If (strProduct = "" OR strPart = "") OR (strProduct = "error" OR strPart = "error") Then %>
<td colspan="2"><font face="arial, helvetica" size="2"><b>Search For A Part Number</b></font></td>
<% Else %>
<td><font face="arial, helvetica" size="2"><b>Sort By</b></font></td>
<% End If %>
</tr>
<tr>
<form action="index.asp" method="get">
<td>
<select name="product">
<option<% If strProduct = "error" Then Response.Write " selected" End If %> value="error"><small>Choos e
a product -></small></option>
<option<% If strProduct = "all" Then Response.Write " selected" End If %> value="all"><small>All Products</small></option>
<option<% If strProduct = "Product1" Then Response.Write " selected" End If %> value="Product1"><small>Pr oduct1</sm all></opti on>
<option<% If strProduct = "Product2" Then Response.Write " selected" End If %> value="Product2"><small>Pr oduct2</sm all></opti on>
<option<% If strProduct = "Product3" Then Response.Write " selected" End If %> value="Product3"><small>Pr oduct3</sm all></opti on>
<option<% If strProduct = "Product4" Then Response.Write " selected" End If %> value="Product4"><small>Pr oduct4</sm all></opti on>
<option<% If strProduct = "Product5" Then Response.Write " selected" End If %> value="Product5"><small>Pr oduct5</sm all></opti on>
</select>
</td>
<td valign="top">
<select name="parts">
<option<% If strPart = "error" Then Response.Write " selected" End If %> value="error"><small>Choos e
a parts type -></small></option>
<option<% If strPart = "all" Then Response.Write " selected" End If %> value="all"><small>All Parts</small></option>
<option<% If strPart = "fru" Then Response.Write " selected" End If %> value="fru"><small>FRU Parts</small></option>
<option<% If strPart = "urp" Then Response.Write " selected" End If %> value="urp"><small>UR Parts</small></option>
<option<% If strPart = "optional" Then Response.Write " selected" End If %> value="optional"><small>Op tional
Accessories</small></optio n>
</select>
</td>
<td>
<input type="submit" value="SUBMIT" onfocus="this.blur()">
</td>
</form>
<% If (strProduct = "" OR strPart = "") OR (strProduct = "error" OR strPart = "error") Then %>
<form action="results.asp" method="get">
<td>
<input type="text" size="10" maxlength="11" name="part" onfocus="if(this.value=='x xx-xxxx-xx ')this.val ue='';"
onblur="if(this.value=='') this.value ='xxx-xxxx -xx';" value="xxx-xxxx-xx">
</td>
<td>
<input type="submit" value="SUBMIT" onfocus="this.blur()">
</td>
</form>
<% End If %>
<% If NOT (strProduct = "" OR strPart = "") AND NOT (strProduct = "error" OR strPart = "error") Then
'AND NOT (numRecs = "" OR numRecs = 0)
%>
<form name="sort">
<td>
<select name="site" size=1 onchange="javascript:sortH andler()">
<option<% If strSort = "COMPONENT_ITEM_NUMBER ASC" Then Response.Write " selected" End If %> value="index.asp?product=< %=strProdu ct%>&parts =<%=strPar t%>&sort=n umeric%20a sc"><small >Part
Number -><!--↑--></small ></option>
<option<% If strSort = "COMPONENT_ITEM_NUMBER DESC" Then Response.Write " selected" End If %> value="index.asp?product=< %=strProdu ct%>&parts =<%=strPar t%>&sort=n umeric%20d esc"><smal l>Part
Number <-<!--↓--></small ></option>
<option<% If strSort = "COMPONENT_ITEM_DESCRIPTIO N ASC" Then Response.Write " selected" End If %> value="index.asp?product=< %=strProdu ct%>&parts =<%=strPar t%>&sort=a lpha%20asc "><small>D escription
A-Z</small></option>
<option<% If strSort = "COMPONENT_ITEM_DESCRIPTIO N DESC" Then Response.Write " selected" End If %> value="index.asp?product=< %=strProdu ct%>&parts =<%=strPar t%>&sort=a lpha%20des c"><small> Descriptio n
Z-A</small></option>
</select>
</td>
</form>
<% End If %>
<% If NOT (strProduct = "" OR strPart = "") AND NOT (strProduct = "error" OR strPart = "error") Then
%>
<form action="download.asp" method="post">
<td>
<img src='/pix/spacer.gif' width='5' height='1'>
<input type="image" value="PRINTER-FRIENDLY" src="/pix/printer_small.gi f" width="16" height="16" border="0">
<input type="hidden" name="product" value="<%=strProduct%>">
<input type="hidden" name="part" value="<%=strPart%>">
</td>
</form>
<% End If %>
</tr>
</table>
<%
If strProduct = "" AND strPart = "" Then
Response.Write("<p><font face='arial, helvetica' size='2'>Select a product and parts type from the select
menus above and click "submit".</font></ p>")
Else If strProduct = "error" OR strPart = "error" Then
Response.Write("<p><font face='arial, helvetica' size='2'><b>You must select a product and a parts type
from the menus to generate a list.<br>You may select 'All Products' or 'All Parts' to generate a list
for all products or parts.</b></font></p>")
Else
Dim recPage, numPages, numRecs, pageSize
recPage = CInt(Request.Form("page"))
If recPage=0 Then recPage=1
pageSize = CInt(Request.Form("recs"))
If pageSize = 0 Then pageSize = 10
Set RecordSet = Server.CreateObject("ADODB .RecordSet ")
RecordSet.PageSize = pageSize
RecordSet.CacheSize = pageSize
RecordSet.CursorLocation = adUseClient
If strPart = "fru" AND NOT strProduct = "all" Then
CommandText = "SELECT COMPONENT_ITEM_NUMBER, COMPONENT_ITEM_DESCRIPTION , [FRU DIRECT AMER], [FRU INDIRECT
AMER], [SVC MFG LIST], [SVC RET FRUS CORE CREDIT], ASSEMBLY_ITEM_NUMBER, TOP_ITEM_NUMBER, COMPONENT_ITEM_LONG_DESC,
SEG=CASE WHEN OM_CAT_SEGMENT1='FRUS (FIELD REPLACEABLE PARTS)' THEN 'YES' ELSE 'NO' END, COM=CASE WHEN
ltrim(rtrim(COMPONENT_ITEM _LONG_DESC )) = '' THEN 'N/A' ELSE isnull(COMPONENT_ITEM_LONG _DESC, 'N/A')
END FROM vIFC_SRV_PART_PRICE_LIST_8 04 WHERE TOP_ITEM_NUMBER = '" & strProduct & "' ORDER BY " & strSort
& ""
Else If strPart = "urp" AND NOT strProduct = "all" Then
CommandText = "SELECT COMPONENT_ITEM_NUMBER, COMPONENT_ITEM_DESCRIPTION , [ACCY AND URP DIRECT AMER],
[SVC MFG LIST], ASSEMBLY_ITEM_NUMBER, TOP_ITEM_NUMBER, SEG=CASE WHEN OM_CAT_SEGMENT1='FRUS (FIELD REPLACEABLE
PARTS)' THEN 'YES' ELSE 'NO' END, COM=CASE WHEN ltrim(rtrim(COMPONENT_ITEM _LONG_DESC )) = '' THEN 'N/A'
ELSE isnull(COMPONENT_ITEM_LONG _DESC, 'N/A') END FROM vIFC_SRV_PART_PRICE_LIST_8 11 WHERE TOP_ITEM_NUMBER
= '" & strProduct & "' ORDER BY " & strSort & ""
Else If strPart = "optional" AND NOT strProduct = "all" Then
CommandText = "SELECT COMPONENT_ITEM_NUMBER, COMPONENT_ITEM_DESCRIPTION , [ACCY AND URP DIRECT AMER],
[SVC MFG LIST], ASSEMBLY_ITEM_NUMBER, TOP_ITEM_NUMBER, SEG=CASE WHEN OM_CAT_SEGMENT1='FRUS (FIELD REPLACEABLE
PARTS)' THEN 'YES' ELSE 'NO' END, COM=CASE WHEN ltrim(rtrim(COMPONENT_ITEM _LONG_DESC )) = '' THEN 'N/A'
ELSE isnull(COMPONENT_ITEM_LONG _DESC, 'N/A') END FROM vIFC_SRV_PART_PRICE_LIST_8 12 WHERE TOP_ITEM_NUMBER
= '" & strProduct & "' ORDER BY " & strSort & ""
Else If strPart = "all" AND NOT strProduct="all" Then
CommandText = "SELECT COMPONENT_ITEM_NUMBER, COMPONENT_ITEM_DESCRIPTION , [FRU DIRECT AMER], [FRU INDIRECT
AMER], [ACCY AND URP DIRECT AMER], [SVC MFG LIST], [SVC RET FRUS CORE CREDIT], ASSEMBLY_ITEM_NUMBER,
TOP_ITEM_NUMBER, SEG=CASE WHEN OM_CAT_SEGMENT1='FRUS (FIELD REPLACEABLE PARTS)' THEN 'YES' ELSE 'NO'
END, COM=CASE WHEN ltrim(rtrim(COMPONENT_ITEM _LONG_DESC )) = '' THEN 'N/A' ELSE isnull(COMPONENT_ITEM_LONG _DESC,
'N/A') END FROM vIFC_SRV_PART_PRICE_LIST_A LL WHERE TOP_ITEM_NUMBER = '" & strProduct & "' ORDER BY "
& strSort & ""
Else If strPart = "fru" AND strProduct = "all" Then
CommandText = "SELECT COMPONENT_ITEM_NUMBER, COMPONENT_ITEM_DESCRIPTION , [FRU DIRECT AMER], [FRU INDIRECT
AMER], [SVC MFG LIST], [SVC RET FRUS CORE CREDIT], ASSEMBLY_ITEM_NUMBER, TOP_ITEM_NUMBER, SEG=CASE WHEN
OM_CAT_SEGMENT1='FRUS (FIELD REPLACEABLE PARTS)' THEN 'YES' ELSE 'NO' END, COM=CASE WHEN ltrim(rtrim(COMPONENT_ITEM _LONG_DESC ))
= '' THEN 'N/A' ELSE isnull(COMPONENT_ITEM_LONG _DESC, 'N/A') END FROM vIFC_SRV_PART_PRICE_LIST_8 04 ORDER
BY " & strSort & ""
Else If strPart = "urp" AND strProduct = "all" Then
CommandText = "SELECT COMPONENT_ITEM_NUMBER, COMPONENT_ITEM_DESCRIPTION , [ACCY AND URP DIRECT AMER],
[SVC MFG LIST], ASSEMBLY_ITEM_NUMBER, TOP_ITEM_NUMBER, SEG=CASE WHEN OM_CAT_SEGMENT1='FRUS (FIELD REPLACEABLE
PARTS)' THEN 'YES' ELSE 'NO' END, COM=CASE WHEN ltrim(rtrim(COMPONENT_ITEM _LONG_DESC )) = '' THEN 'N/A'
ELSE isnull(COMPONENT_ITEM_LONG _DESC, 'N/A') END FROM vIFC_SRV_PART_PRICE_LIST_8 11 ORDER BY " & strSort
& ""
Else If strPart = "optional" AND strProduct = "all" Then
CommandText = "SELECT COMPONENT_ITEM_NUMBER, COMPONENT_ITEM_DESCRIPTION , [ACCY AND URP DIRECT AMER],
[SVC MFG LIST], ASSEMBLY_ITEM_NUMBER, TOP_ITEM_NUMBER, SEG=CASE WHEN OM_CAT_SEGMENT1='FRUS (FIELD REPLACEABLE
PARTS)' THEN 'YES' ELSE 'NO' END, COM=CASE WHEN ltrim(rtrim(COMPONENT_ITEM _LONG_DESC )) = '' THEN 'N/A'
ELSE isnull(COMPONENT_ITEM_LONG _DESC, 'N/A') END FROM vIFC_SRV_PART_PRICE_LIST_8 12 ORDER BY " & strSort
& ""
Else If strPart = "all" AND strProduct = "all" Then
CommandText = "SELECT COMPONENT_ITEM_NUMBER, COMPONENT_ITEM_DESCRIPTION , [FRU DIRECT AMER], [FRU INDIRECT
AMER], [ACCY AND URP DIRECT AMER], [SVC MFG LIST], [SVC RET FRUS CORE CREDIT], ASSEMBLY_ITEM_NUMBER,
TOP_ITEM_NUMBER, SEG=CASE WHEN OM_CAT_SEGMENT1='FRUS (FIELD REPLACEABLE PARTS)' THEN 'YES' ELSE 'NO'
END, COM=CASE WHEN ltrim(rtrim(COMPONENT_ITEM _LONG_DESC )) = '' THEN 'N/A' ELSE isnull(COMPONENT_ITEM_LONG _DESC,
'N/A') END FROM vIFC_SRV_PART_PRICE_LIST_A LL ORDER BY " & strSort & ""
End If
End If
End If
End If
End If
End If
End If
End If
RecordSet.Open CommandText, cmdDC, 2, 2, 1
numPages = RecordSet.PageCount
numRecs = RecordSet.RecordCount
If recPage > numPages Then recPage = numPages
If recPage < 1 Then recPage = 1
Response.Write ("<br>")
Response.Flush
If strPart = "fru" AND RecordSet.BOF AND RecordSet.EOF Then
Response.Write("<p><font face='arial, helvetica' size='2'><b>There are no FRU parts for the " & strProduct
& " at this time.</b></font></p>")
Else If strPart = "urp" AND RecordSet.BOF AND RecordSet.EOF Then
Response.Write("<p><font face='arial, helvetica' size='2'><b>There are no UR parts for the " & strProduct
& " at this time.</b></font></p>")
Else If strPart = "optional" AND RecordSet.BOF AND RecordSet.EOF Then
Response.Write("<p><font face='arial, helvetica' size='2'><b>There are no optional accessories for the
" & strProduct & " at this time.</b></font></p>")
Else
RecordSet.AbsolutePage = recPage
Dim i
For i = 1 To pageSize
If NOT RecordSet.EOF Then
Response.Write("<table border='0' cellpadding='3' cellspacing='0' width='100%'>")
If strSort = "COMPONENT_ITEM_NUMBER ASC" OR strSort = "COMPONENT_ITEM_NUMBER DESC" Then
Response.Write("<tr>")
Response.Write("<td width='20%'><font face='arial, helvetica' size='2'><b>Part Number</b></font></td>"
&_
"<td><font face='arial, helvetica' size='2'><b>" & RecordSet.Fields("COMPONEN T_ITEM_NUM BER")
& "</b></font></td>")
Response.Write("</tr>")
Response.Write("<tr>")
Response.Write("<td width='20%'><font face='arial, helvetica' size='2'><b>Description</b ></font></ td>"
&_
"<td><font face='arial, helvetica' size='2'>" & RecordSet.Fields("COMPONEN T_ITEM_DES CRIPTION")
& "</font></td>")
Response.Write("</tr>")
Else If strSort = "COMPONENT_ITEM_DESCRIPTIO N ASC" OR strSort = "COMPONENT_ITEM_DESCRIPTIO N DESC" Then
Response.Write("<tr>")
Response.Write("<td width='20%'><font face='arial, helvetica' size='2'><b>Description</b ></font></ td>"
&_
"<td><font face='arial, helvetica' size='2'>" & RecordSet.Fields("COMPONEN T_ITEM_DES CRIPTION")
& "</font></td>")
Response.Write("</tr>")
Response.Write("<tr>")
Response.Write("<td width='20%'><font face='arial, helvetica' size='2'><b>Part Number</b></font></td>"
&_
"<td><font face='arial, helvetica' size='2'><b>" & RecordSet.Fields("COMPONEN T_ITEM_NUM BER")
& "</b></font></td>")
Response.Write("</tr>")
End If
End If
If Mid(RecordSet.Fields("ASSE MBLY_ITEM_ NUMBER"), 1, 3) = "804" Then
Response.Write("<tr>")
Response.Write("<td width='20%'><font face='arial, helvetica' size='2'><b>Returnable?</b ></font></ td>"
&_
"<td><font face='arial, helvetica' size='2'>" & RecordSet.Fields("SEG") & "</font></td>")
Response.Write("</tr>")
End If
If Mid(RecordSet.Fields("ASSE MBLY_ITEM_ NUMBER"), 1, 3) = "804" Then
Response.Write("<tr>")
Response.Write("<td width='20%'><font face='arial, helvetica' size='2'><b>FSC/ISC Price</b></font></td>"
&_
"<td><font face='arial, helvetica' size='2'>$" & RecordSet.Fields("FRU DIRECT AMER")
& ".00</font></td>")
Response.Write("</tr>")
Response.Write("<tr>")
Response.Write("<td width='20%'><font face='arial, helvetica' size='2'><b>ASC Price</b></font></td>"
&_
"<td><font face='arial, helvetica' size='2'>$" & RecordSet.Fields("FRU INDIRECT AMER")
& ".00</font></td>")
Response.Write("</tr>")
Else If Mid(RecordSet.Fields("ASSE MBLY_ITEM_ NUMBER"), 1, 3) = "811" Then
Response.Write("<tr>")
Response.Write("<td width='20%'><font face='arial, helvetica' size='2'><b>Price</b></fon t></td>" &_
"<td><font face='arial, helvetica' size='2'>$" & RecordSet.Fields("ACCY AND URP DIRECT
AMER") & ".00</font></td>")
Response.Write("</tr>")
Else If Mid(RecordSet.Fields("ASSE MBLY_ITEM_ NUMBER"), 1, 3) = "812" Then
Response.Write("<tr>")
Response.Write("<td width='20%'><font face='arial, helvetica' size='2'><b>Price</b></fon t></td>" &_
"<td><font face='arial, helvetica' size='2'>$" & RecordSet.Fields("ACCY AND URP DIRECT
AMER") & ".00</font></td>")
Response.Write("</tr>")
End If
End If
End If
Response.Write("<tr>")
Response.Write("<td width='20%'><font face='arial, helvetica' size='2'><b>List Price</b></font></td>"
&_
"<td><font face='arial, helvetica' size='2'>$" & RecordSet.Fields("SVC MFG LIST") & ".00</font></td>")
Response.Write("</tr>")
If Mid(RecordSet.Fields("ASSE MBLY_ITEM_ NUMBER"), 1, 3) = "804" AND NOT RecordSet.Fields("SEG") = "NO"
Then
Response.Write("<tr>")
Response.Write("<td width='20%'><font face='arial, helvetica' size='2'><b>Return Credit</b></font></td>"
&_
"<td><font face='arial, helvetica' size='2'>$" & RecordSet.Fields("SVC RET FRUS CORE
CREDIT") & ".00</font></td>")
Response.Write("</tr>")
End If
If strPart = "all" Then
Dim strPartType
If Mid(RecordSet.Fields("ASSE MBLY_ITEM_ NUMBER"), 1, 3) = "804" Then
strPartType = "Field Replaceable Unit (FRU)"
Else If Mid(RecordSet.Fields("ASSE MBLY_ITEM_ NUMBER"), 1, 3) = "811" Then
strPartType = "User Replaceable (UR) Part"
Else If Mid(RecordSet.Fields("ASSE MBLY_ITEM_ NUMBER"), 1, 3) = "812" Then
strPartType = "Optional Accessory"
End If
End If
End If
Response.Write("<tr>")
Response.Write("<td width='20%'><font face='arial, helvetica' size='2'><b>Part Type</b></font></td>"
&_
"<td><font face='arial, helvetica' size='2'>" & strPartType & "</font></td>")
Response.Write("</tr>")
End If
If strProduct = "all" Then
Response.Write("<tr>")
Response.Write("<td width='20%'><font face='arial, helvetica' size='2'><b>Used On</b></font></td>" &_
"<td><font face='arial, helvetica' size='2'>" & RecordSet.Fields("TOP_ITEM _NUMBER") &
"</font></td>")
Response.Write("</tr>")
End If
Response.Write("<tr>")
Response.Write("<td width='20%' valign='top'><font face='arial, helvetica' size='2'><b>Comments</b></ font></td> "
&_
"<td><font face='arial, helvetica' size='2'>" & RecordSet.Fields("COM") & "</font></td>")
Response.Write("</tr>")
Response.Write("</table>")
RecordSet.MoveNext
If NOT RecordSet.EOF Then
Response.Write("<table border='0' cellpadding='0' cellspacing='5' width='100%'>")
Response.Write("<tr>")
Response.Write("<td bgcolor='#339900' height='1' colspan='2'><img src='/pix/spacer.gif' height='1'></td>")
Response.Write("</tr>")
Response.Write("</table>")
End If
End If
Next
RecordSet.Close
cmdDC.Close
Set RecordSet = Nothing
Set cmdDC = Nothing
End If
End If
End If
End If
End If
%>
<% If NOT numRecs = "" AND NOT numRecs = 0 Then %>
<form name="recsform" action="index.asp?<%=Reque st.Serverv ariables(" QUERY_STRI NG")%>" method="post">
<p><!--<font face="arial, helvetica" size="2"><%=numRecs%> Records</font><br>-->
<font face="arial, helvetica" size="2">Show </font>
<select name="recs" onchange="updateBoxes(recs form)">
<% If numRecs < 10 Then %>
<option value="<%=numRecs%>"><%=nu mRecs%></o ption>
<% End If %>
<% If numRecs >= 10 Then %>
<option<% If pageSize = 10 Then Response.Write " selected" End If %> value="10">10</option>
<% End If %>
<% If numRecs >= 25 Then %>
<option<% If pageSize = 25 Then Response.Write " selected" End If %> value="25">25</option>
<% End If %>
<% If numRecs >= 50 Then %>
<option<% If pageSize = 50 Then Response.Write " selected" End If %> value="50">50</option>
<% End If %>
<% If numRecs >= 100 Then %>
<option<% If pageSize = 100 Then Response.Write " selected" End If %> value="100">100</option>
<% End If %>
<% If numRecs <= 100 AND NOT numRecs < 10 Then %>
<option<% If pageSize = numRecs Then Response.Write " selected" End If %> value="<%=numRecs%>">All</ option>
<% End If %>
</select>
<font face="arial, helvetica" size="2"> records per page</font><br>
<!--<font face="arial, helvetica" size="2">Page <%=recPage%> of <%=numPages%></font><br>-- >
<font face="arial, helvetica" size="2">Display page </font>
<select name="page">
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
</select><br>
<input type="submit" value="GO" onfocus="this.blur()"></p>
</form>
<SCRIPT LANGUAGE="JavaScript">
<!--
NUM_RECORDS = <%=numRecs%>;
function updateBoxes(theFormObj)
{
var selectedRecs = theFormObj.recs.options[th eFormObj.r ecs.select edIndex].v alue;
var numpages = Math.ceil(NUM_RECORDS / selectedRecs);
var numOptions = theFormObj.page.length;
for(var i=0 ; i<numOptions ; i++){
theFormObj.page.options[0] = null;
}
for(var j=0 ; j<numpages ; j++){
theFormObj.page.options[j] = new Option(j+1,j+1);
}
theFormObj.page.selectedIn dex = 0;
}
// -->
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
<!--
updateBoxes(document.recsf orm);
// -->
</SCRIPT>
<% End If %>
<p> </p>
</BODY>
</HTML>
<% @ LANGUAGE="VBScript" %>
<% Option Explicit %>
<%
Response.Expires = 0
Response.Buffer = True
Server.ScriptTimeout = 360
Const adOpenForwardOnly = 0
Const adLockReadOnly = 1
Const adUseClient = 3
Const adCmdText = 1
Dim cmdDC, RecordSet, DataConnection, CommandText
DataConnection = "DRIVER=SQL Server;SERVER=server;DATAB
Set cmdDC = Server.CreateObject("ADODB
cmdDC.Open DataConnection
Dim strProduct, strPart, strSort
strProduct = Request.Querystring("produ
strPart = Request.Querystring("parts
strSort = Request.Querystring("sort"
If strSort = "" Then
strSort = "COMPONENT_ITEM_NUMBER ASC"
Else If strSort = "numeric asc" Then
strSort = "COMPONENT_ITEM_NUMBER ASC"
Else If strSort = "numeric desc" Then
strSort = "COMPONENT_ITEM_NUMBER DESC"
Else If strSort = "alpha asc" Then
strSort = "COMPONENT_ITEM_DESCRIPTIO
Else If strSort = "alpha desc" Then
strSort = "COMPONENT_ITEM_DESCRIPTIO
End If
End If
End If
End If
End If
Dim aProducts
aProducts = Array("product1", "product2", "product3", "product4", "product5")
%>
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
function sortHandler(sort){
var URL = document.sort.site.options
window.location.href = URL;
}
// -->
</SCRIPT>
</HEAD>
<BODY>
<p> </p>
<table border="0" cellpadding="3" cellspacing="0" width="100%">
<tr>
<td><font face="arial, helvetica" size="2"><b>Select Product</b></font></td>
<td colspan="2"><font face="arial, helvetica" size="2"><b>Select Parts Type</b></font></td>
<% If (strProduct = "" OR strPart = "") OR (strProduct = "error" OR strPart = "error") Then %>
<td colspan="2"><font face="arial, helvetica" size="2"><b>Search For A Part Number</b></font></td>
<% Else %>
<td><font face="arial, helvetica" size="2"><b>Sort By</b></font></td>
<% End If %>
</tr>
<tr>
<form action="index.asp" method="get">
<td>
<select name="product">
<option<% If strProduct = "error" Then Response.Write " selected" End If %> value="error"><small>Choos
a product -></small></option>
<option<% If strProduct = "all" Then Response.Write " selected" End If %> value="all"><small>All Products</small></option>
<option<% If strProduct = "Product1" Then Response.Write " selected" End If %> value="Product1"><small>Pr
<option<% If strProduct = "Product2" Then Response.Write " selected" End If %> value="Product2"><small>Pr
<option<% If strProduct = "Product3" Then Response.Write " selected" End If %> value="Product3"><small>Pr
<option<% If strProduct = "Product4" Then Response.Write " selected" End If %> value="Product4"><small>Pr
<option<% If strProduct = "Product5" Then Response.Write " selected" End If %> value="Product5"><small>Pr
</select>
</td>
<td valign="top">
<select name="parts">
<option<% If strPart = "error" Then Response.Write " selected" End If %> value="error"><small>Choos
a parts type -></small></option>
<option<% If strPart = "all" Then Response.Write " selected" End If %> value="all"><small>All Parts</small></option>
<option<% If strPart = "fru" Then Response.Write " selected" End If %> value="fru"><small>FRU Parts</small></option>
<option<% If strPart = "urp" Then Response.Write " selected" End If %> value="urp"><small>UR Parts</small></option>
<option<% If strPart = "optional" Then Response.Write " selected" End If %> value="optional"><small>Op
Accessories</small></optio
</select>
</td>
<td>
<input type="submit" value="SUBMIT" onfocus="this.blur()">
</td>
</form>
<% If (strProduct = "" OR strPart = "") OR (strProduct = "error" OR strPart = "error") Then %>
<form action="results.asp" method="get">
<td>
<input type="text" size="10" maxlength="11" name="part" onfocus="if(this.value=='x
onblur="if(this.value=='')
</td>
<td>
<input type="submit" value="SUBMIT" onfocus="this.blur()">
</td>
</form>
<% End If %>
<% If NOT (strProduct = "" OR strPart = "") AND NOT (strProduct = "error" OR strPart = "error") Then
'AND NOT (numRecs = "" OR numRecs = 0)
%>
<form name="sort">
<td>
<select name="site" size=1 onchange="javascript:sortH
<option<% If strSort = "COMPONENT_ITEM_NUMBER ASC" Then Response.Write " selected" End If %> value="index.asp?product=<
Number -><!--↑--></small
<option<% If strSort = "COMPONENT_ITEM_NUMBER DESC" Then Response.Write " selected" End If %> value="index.asp?product=<
Number <-<!--↓--></small
<option<% If strSort = "COMPONENT_ITEM_DESCRIPTIO
A-Z</small></option>
<option<% If strSort = "COMPONENT_ITEM_DESCRIPTIO
Z-A</small></option>
</select>
</td>
</form>
<% End If %>
<% If NOT (strProduct = "" OR strPart = "") AND NOT (strProduct = "error" OR strPart = "error") Then
%>
<form action="download.asp" method="post">
<td>
<img src='/pix/spacer.gif' width='5' height='1'>
<input type="image" value="PRINTER-FRIENDLY" src="/pix/printer_small.gi
<input type="hidden" name="product" value="<%=strProduct%>">
<input type="hidden" name="part" value="<%=strPart%>">
</td>
</form>
<% End If %>
</tr>
</table>
<%
If strProduct = "" AND strPart = "" Then
Response.Write("<p><font face='arial, helvetica' size='2'>Select a product and parts type from the select
menus above and click "submit".</font></
Else If strProduct = "error" OR strPart = "error" Then
Response.Write("<p><font face='arial, helvetica' size='2'><b>You must select a product and a parts type
from the menus to generate a list.<br>You may select 'All Products' or 'All Parts' to generate a list
for all products or parts.</b></font></p>")
Else
Dim recPage, numPages, numRecs, pageSize
recPage = CInt(Request.Form("page"))
If recPage=0 Then recPage=1
pageSize = CInt(Request.Form("recs"))
If pageSize = 0 Then pageSize = 10
Set RecordSet = Server.CreateObject("ADODB
RecordSet.PageSize = pageSize
RecordSet.CacheSize = pageSize
RecordSet.CursorLocation = adUseClient
If strPart = "fru" AND NOT strProduct = "all" Then
CommandText = "SELECT COMPONENT_ITEM_NUMBER, COMPONENT_ITEM_DESCRIPTION
AMER], [SVC MFG LIST], [SVC RET FRUS CORE CREDIT], ASSEMBLY_ITEM_NUMBER, TOP_ITEM_NUMBER, COMPONENT_ITEM_LONG_DESC,
SEG=CASE WHEN OM_CAT_SEGMENT1='FRUS (FIELD REPLACEABLE PARTS)' THEN 'YES' ELSE 'NO' END, COM=CASE WHEN
ltrim(rtrim(COMPONENT_ITEM
END FROM vIFC_SRV_PART_PRICE_LIST_8
& ""
Else If strPart = "urp" AND NOT strProduct = "all" Then
CommandText = "SELECT COMPONENT_ITEM_NUMBER, COMPONENT_ITEM_DESCRIPTION
[SVC MFG LIST], ASSEMBLY_ITEM_NUMBER, TOP_ITEM_NUMBER, SEG=CASE WHEN OM_CAT_SEGMENT1='FRUS (FIELD REPLACEABLE
PARTS)' THEN 'YES' ELSE 'NO' END, COM=CASE WHEN ltrim(rtrim(COMPONENT_ITEM
ELSE isnull(COMPONENT_ITEM_LONG
= '" & strProduct & "' ORDER BY " & strSort & ""
Else If strPart = "optional" AND NOT strProduct = "all" Then
CommandText = "SELECT COMPONENT_ITEM_NUMBER, COMPONENT_ITEM_DESCRIPTION
[SVC MFG LIST], ASSEMBLY_ITEM_NUMBER, TOP_ITEM_NUMBER, SEG=CASE WHEN OM_CAT_SEGMENT1='FRUS (FIELD REPLACEABLE
PARTS)' THEN 'YES' ELSE 'NO' END, COM=CASE WHEN ltrim(rtrim(COMPONENT_ITEM
ELSE isnull(COMPONENT_ITEM_LONG
= '" & strProduct & "' ORDER BY " & strSort & ""
Else If strPart = "all" AND NOT strProduct="all" Then
CommandText = "SELECT COMPONENT_ITEM_NUMBER, COMPONENT_ITEM_DESCRIPTION
AMER], [ACCY AND URP DIRECT AMER], [SVC MFG LIST], [SVC RET FRUS CORE CREDIT], ASSEMBLY_ITEM_NUMBER,
TOP_ITEM_NUMBER, SEG=CASE WHEN OM_CAT_SEGMENT1='FRUS (FIELD REPLACEABLE PARTS)' THEN 'YES' ELSE 'NO'
END, COM=CASE WHEN ltrim(rtrim(COMPONENT_ITEM
'N/A') END FROM vIFC_SRV_PART_PRICE_LIST_A
& strSort & ""
Else If strPart = "fru" AND strProduct = "all" Then
CommandText = "SELECT COMPONENT_ITEM_NUMBER, COMPONENT_ITEM_DESCRIPTION
AMER], [SVC MFG LIST], [SVC RET FRUS CORE CREDIT], ASSEMBLY_ITEM_NUMBER, TOP_ITEM_NUMBER, SEG=CASE WHEN
OM_CAT_SEGMENT1='FRUS (FIELD REPLACEABLE PARTS)' THEN 'YES' ELSE 'NO' END, COM=CASE WHEN ltrim(rtrim(COMPONENT_ITEM
= '' THEN 'N/A' ELSE isnull(COMPONENT_ITEM_LONG
BY " & strSort & ""
Else If strPart = "urp" AND strProduct = "all" Then
CommandText = "SELECT COMPONENT_ITEM_NUMBER, COMPONENT_ITEM_DESCRIPTION
[SVC MFG LIST], ASSEMBLY_ITEM_NUMBER, TOP_ITEM_NUMBER, SEG=CASE WHEN OM_CAT_SEGMENT1='FRUS (FIELD REPLACEABLE
PARTS)' THEN 'YES' ELSE 'NO' END, COM=CASE WHEN ltrim(rtrim(COMPONENT_ITEM
ELSE isnull(COMPONENT_ITEM_LONG
& ""
Else If strPart = "optional" AND strProduct = "all" Then
CommandText = "SELECT COMPONENT_ITEM_NUMBER, COMPONENT_ITEM_DESCRIPTION
[SVC MFG LIST], ASSEMBLY_ITEM_NUMBER, TOP_ITEM_NUMBER, SEG=CASE WHEN OM_CAT_SEGMENT1='FRUS (FIELD REPLACEABLE
PARTS)' THEN 'YES' ELSE 'NO' END, COM=CASE WHEN ltrim(rtrim(COMPONENT_ITEM
ELSE isnull(COMPONENT_ITEM_LONG
& ""
Else If strPart = "all" AND strProduct = "all" Then
CommandText = "SELECT COMPONENT_ITEM_NUMBER, COMPONENT_ITEM_DESCRIPTION
AMER], [ACCY AND URP DIRECT AMER], [SVC MFG LIST], [SVC RET FRUS CORE CREDIT], ASSEMBLY_ITEM_NUMBER,
TOP_ITEM_NUMBER, SEG=CASE WHEN OM_CAT_SEGMENT1='FRUS (FIELD REPLACEABLE PARTS)' THEN 'YES' ELSE 'NO'
END, COM=CASE WHEN ltrim(rtrim(COMPONENT_ITEM
'N/A') END FROM vIFC_SRV_PART_PRICE_LIST_A
End If
End If
End If
End If
End If
End If
End If
End If
RecordSet.Open CommandText, cmdDC, 2, 2, 1
numPages = RecordSet.PageCount
numRecs = RecordSet.RecordCount
If recPage > numPages Then recPage = numPages
If recPage < 1 Then recPage = 1
Response.Write ("<br>")
Response.Flush
If strPart = "fru" AND RecordSet.BOF AND RecordSet.EOF Then
Response.Write("<p><font face='arial, helvetica' size='2'><b>There are no FRU parts for the " & strProduct
& " at this time.</b></font></p>")
Else If strPart = "urp" AND RecordSet.BOF AND RecordSet.EOF Then
Response.Write("<p><font face='arial, helvetica' size='2'><b>There are no UR parts for the " & strProduct
& " at this time.</b></font></p>")
Else If strPart = "optional" AND RecordSet.BOF AND RecordSet.EOF Then
Response.Write("<p><font face='arial, helvetica' size='2'><b>There are no optional accessories for the
" & strProduct & " at this time.</b></font></p>")
Else
RecordSet.AbsolutePage = recPage
Dim i
For i = 1 To pageSize
If NOT RecordSet.EOF Then
Response.Write("<table border='0' cellpadding='3' cellspacing='0' width='100%'>")
If strSort = "COMPONENT_ITEM_NUMBER ASC" OR strSort = "COMPONENT_ITEM_NUMBER DESC" Then
Response.Write("<tr>")
Response.Write("<td width='20%'><font face='arial, helvetica' size='2'><b>Part Number</b></font></td>"
&_
"<td><font face='arial, helvetica' size='2'><b>" & RecordSet.Fields("COMPONEN
& "</b></font></td>")
Response.Write("</tr>")
Response.Write("<tr>")
Response.Write("<td width='20%'><font face='arial, helvetica' size='2'><b>Description</b
&_
"<td><font face='arial, helvetica' size='2'>" & RecordSet.Fields("COMPONEN
& "</font></td>")
Response.Write("</tr>")
Else If strSort = "COMPONENT_ITEM_DESCRIPTIO
Response.Write("<tr>")
Response.Write("<td width='20%'><font face='arial, helvetica' size='2'><b>Description</b
&_
"<td><font face='arial, helvetica' size='2'>" & RecordSet.Fields("COMPONEN
& "</font></td>")
Response.Write("</tr>")
Response.Write("<tr>")
Response.Write("<td width='20%'><font face='arial, helvetica' size='2'><b>Part Number</b></font></td>"
&_
"<td><font face='arial, helvetica' size='2'><b>" & RecordSet.Fields("COMPONEN
& "</b></font></td>")
Response.Write("</tr>")
End If
End If
If Mid(RecordSet.Fields("ASSE
Response.Write("<tr>")
Response.Write("<td width='20%'><font face='arial, helvetica' size='2'><b>Returnable?</b
&_
"<td><font face='arial, helvetica' size='2'>" & RecordSet.Fields("SEG") & "</font></td>")
Response.Write("</tr>")
End If
If Mid(RecordSet.Fields("ASSE
Response.Write("<tr>")
Response.Write("<td width='20%'><font face='arial, helvetica' size='2'><b>FSC/ISC Price</b></font></td>"
&_
"<td><font face='arial, helvetica' size='2'>$" & RecordSet.Fields("FRU DIRECT AMER")
& ".00</font></td>")
Response.Write("</tr>")
Response.Write("<tr>")
Response.Write("<td width='20%'><font face='arial, helvetica' size='2'><b>ASC Price</b></font></td>"
&_
"<td><font face='arial, helvetica' size='2'>$" & RecordSet.Fields("FRU INDIRECT AMER")
& ".00</font></td>")
Response.Write("</tr>")
Else If Mid(RecordSet.Fields("ASSE
Response.Write("<tr>")
Response.Write("<td width='20%'><font face='arial, helvetica' size='2'><b>Price</b></fon
"<td><font face='arial, helvetica' size='2'>$" & RecordSet.Fields("ACCY AND URP DIRECT
AMER") & ".00</font></td>")
Response.Write("</tr>")
Else If Mid(RecordSet.Fields("ASSE
Response.Write("<tr>")
Response.Write("<td width='20%'><font face='arial, helvetica' size='2'><b>Price</b></fon
"<td><font face='arial, helvetica' size='2'>$" & RecordSet.Fields("ACCY AND URP DIRECT
AMER") & ".00</font></td>")
Response.Write("</tr>")
End If
End If
End If
Response.Write("<tr>")
Response.Write("<td width='20%'><font face='arial, helvetica' size='2'><b>List Price</b></font></td>"
&_
"<td><font face='arial, helvetica' size='2'>$" & RecordSet.Fields("SVC MFG LIST") & ".00</font></td>")
Response.Write("</tr>")
If Mid(RecordSet.Fields("ASSE
Then
Response.Write("<tr>")
Response.Write("<td width='20%'><font face='arial, helvetica' size='2'><b>Return Credit</b></font></td>"
&_
"<td><font face='arial, helvetica' size='2'>$" & RecordSet.Fields("SVC RET FRUS CORE
CREDIT") & ".00</font></td>")
Response.Write("</tr>")
End If
If strPart = "all" Then
Dim strPartType
If Mid(RecordSet.Fields("ASSE
strPartType = "Field Replaceable Unit (FRU)"
Else If Mid(RecordSet.Fields("ASSE
strPartType = "User Replaceable (UR) Part"
Else If Mid(RecordSet.Fields("ASSE
strPartType = "Optional Accessory"
End If
End If
End If
Response.Write("<tr>")
Response.Write("<td width='20%'><font face='arial, helvetica' size='2'><b>Part Type</b></font></td>"
&_
"<td><font face='arial, helvetica' size='2'>" & strPartType & "</font></td>")
Response.Write("</tr>")
End If
If strProduct = "all" Then
Response.Write("<tr>")
Response.Write("<td width='20%'><font face='arial, helvetica' size='2'><b>Used On</b></font></td>" &_
"<td><font face='arial, helvetica' size='2'>" & RecordSet.Fields("TOP_ITEM
"</font></td>")
Response.Write("</tr>")
End If
Response.Write("<tr>")
Response.Write("<td width='20%' valign='top'><font face='arial, helvetica' size='2'><b>Comments</b></
&_
"<td><font face='arial, helvetica' size='2'>" & RecordSet.Fields("COM") & "</font></td>")
Response.Write("</tr>")
Response.Write("</table>")
RecordSet.MoveNext
If NOT RecordSet.EOF Then
Response.Write("<table border='0' cellpadding='0' cellspacing='5' width='100%'>")
Response.Write("<tr>")
Response.Write("<td bgcolor='#339900' height='1' colspan='2'><img src='/pix/spacer.gif' height='1'></td>")
Response.Write("</tr>")
Response.Write("</table>")
End If
End If
Next
RecordSet.Close
cmdDC.Close
Set RecordSet = Nothing
Set cmdDC = Nothing
End If
End If
End If
End If
End If
%>
<% If NOT numRecs = "" AND NOT numRecs = 0 Then %>
<form name="recsform" action="index.asp?<%=Reque
<p><!--<font face="arial, helvetica" size="2"><%=numRecs%> Records</font><br>-->
<font face="arial, helvetica" size="2">Show </font>
<select name="recs" onchange="updateBoxes(recs
<% If numRecs < 10 Then %>
<option value="<%=numRecs%>"><%=nu
<% End If %>
<% If numRecs >= 10 Then %>
<option<% If pageSize = 10 Then Response.Write " selected" End If %> value="10">10</option>
<% End If %>
<% If numRecs >= 25 Then %>
<option<% If pageSize = 25 Then Response.Write " selected" End If %> value="25">25</option>
<% End If %>
<% If numRecs >= 50 Then %>
<option<% If pageSize = 50 Then Response.Write " selected" End If %> value="50">50</option>
<% End If %>
<% If numRecs >= 100 Then %>
<option<% If pageSize = 100 Then Response.Write " selected" End If %> value="100">100</option>
<% End If %>
<% If numRecs <= 100 AND NOT numRecs < 10 Then %>
<option<% If pageSize = numRecs Then Response.Write " selected" End If %> value="<%=numRecs%>">All</
<% End If %>
</select>
<font face="arial, helvetica" size="2"> records per page</font><br>
<!--<font face="arial, helvetica" size="2">Page <%=recPage%> of <%=numPages%></font><br>--
<font face="arial, helvetica" size="2">Display page </font>
<select name="page">
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
</select><br>
<input type="submit" value="GO" onfocus="this.blur()"></p>
</form>
<SCRIPT LANGUAGE="JavaScript">
<!--
NUM_RECORDS = <%=numRecs%>;
function updateBoxes(theFormObj)
{
var selectedRecs = theFormObj.recs.options[th
var numpages = Math.ceil(NUM_RECORDS / selectedRecs);
var numOptions = theFormObj.page.length;
for(var i=0 ; i<numOptions ; i++){
theFormObj.page.options[0]
}
for(var j=0 ; j<numpages ; j++){
theFormObj.page.options[j]
}
theFormObj.page.selectedIn
}
// -->
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
<!--
updateBoxes(document.recsf
// -->
</SCRIPT>
<% End If %>
<p> </p>
</BODY>
</HTML>
ASKER
GreenGhost and giladBoker,
I have tried both of your methods again and still with no luck. Any ideas now that you see my whole page?
David
I have tried both of your methods again and still with no luck. Any ideas now that you see my whole page?
David
What I see from your code is:
- It's fairly well written.
- You should place all the Dim statements at the top of the page. They are all performed before any code anyway, so there is no reason to spread them throughout the page.
- The code would benefit from using ElseIf instead of Else If. For an example:
If strSort = "" Then
...
Else If strSort = "numeric asc" Then
...
Else If strSort = "numeric desc" Then
...
Else If strSort = "alpha asc" Then
...
Else If strSort = "alpha desc" Then
...
End If
End If
End If
End If
End If
can be replaced by:
If strSort = "" Then
...
ElseIf strSort = "numeric asc" Then
...
ElseIf strSort = "numeric desc" Then
...
ElseIf strSort = "alpha asc" Then
...
ElseIf strSort = "alpha desc" Then
...
End If
In this case, it can even be coded with a Select Case statement:
Select Case strSort
Case ""
...
Case "numeric asc"
...
Case "numeric desc"
...
Case "alpha asc"
...
Case "alpha desc"
...
End Select
I can add nothing furter. If you take the code I have posted and put it in the select list, it should work. If you remember to dimension the counter, and check that it's not already used on the page, there should be no problem.
IF you can't get it to work, I need more input, like what the error message is.
- It's fairly well written.
- You should place all the Dim statements at the top of the page. They are all performed before any code anyway, so there is no reason to spread them throughout the page.
- The code would benefit from using ElseIf instead of Else If. For an example:
If strSort = "" Then
...
Else If strSort = "numeric asc" Then
...
Else If strSort = "numeric desc" Then
...
Else If strSort = "alpha asc" Then
...
Else If strSort = "alpha desc" Then
...
End If
End If
End If
End If
End If
can be replaced by:
If strSort = "" Then
...
ElseIf strSort = "numeric asc" Then
...
ElseIf strSort = "numeric desc" Then
...
ElseIf strSort = "alpha asc" Then
...
ElseIf strSort = "alpha desc" Then
...
End If
In this case, it can even be coded with a Select Case statement:
Select Case strSort
Case ""
...
Case "numeric asc"
...
Case "numeric desc"
...
Case "alpha asc"
...
Case "alpha desc"
...
End Select
I can add nothing furter. If you take the code I have posted and put it in the select list, it should work. If you remember to dimension the counter, and check that it's not already used on the page, there should be no problem.
IF you can't get it to work, I need more input, like what the error message is.
ASKER
I made the changed you talked about with adding all of the dims at the begining of the page and and change the Else terms to ElseIf terms. I'm all for efficiency. I have to say though, it's quite acompliment when you say it was well written coming from somebody like you who knows something about it to somebody like me who knows nothing. :-) Thank you for that.
I changed the your variable from 1ngPage to ingPage because when I tried to use 1ngpage, it would give me an "Expected identifier" error. I figured an i looks like a 1 so that's why I used that. Anyway, the page loads and everything and the "page" select menu is popuated with valid choices and everything but it still does not write "selected" to the option you choose when it takes you to that page. Weird. Anyway, here is the code as it exists now in case I have done anything wrong:
% @ LANGUAGE="VBScript" %>
% Option Explicit %>
!--#INCLUDE VIRTUAL="/service/asc/auth _all.asp"- ->
%
Response.Expires = 0
Response.Buffer = True
Server.ScriptTimeout = 360
Const adOpenForwardOnly = 0
Const adLockReadOnly = 1
Const adUseClient = 3
Const adCmdText = 1
Dim cmdDC, RecordSet, DataConnection, CommandText, i, strProduct, strPart, strSort, recPage, numPages, numRecs, pageSize, ingPage, strPartType, aProducts
DataConnection = "DRIVER=SQL Server;SERVER=MYSERVER;DAT ABASE=Prod Service;UI D=uid;PWD= passwd"
Set cmdDC = Server.CreateObject("ADODB .Connectio n")
cmdDC.Open DataConnection
strProduct = Request.Querystring("produ ct")
strPart = Request.Querystring("parts ")
strSort = Request.Querystring("sort" )
If strSort = "" Then
strSort = "COMPONENT_ITEM_NUMBER ASC"
ElseIf strSort = "numeric asc" Then
strSort = "COMPONENT_ITEM_NUMBER ASC"
ElseIf strSort = "numeric desc" Then
strSort = "COMPONENT_ITEM_NUMBER DESC"
ElseIf strSort = "alpha asc" Then
strSort = "COMPONENT_ITEM_DESCRIPTIO N ASC"
ElseIf strSort = "alpha desc" Then
strSort = "COMPONENT_ITEM_DESCRIPTIO N DESC"
End If
If NOT (strProduct = "" AND strPart = "") AND NOT (strProduct = "error" OR strPart = "error") Then
recPage = CInt(Request.Form("page"))
If recPage=0 Then recPage=1
pageSize = CInt(Request.Form("recs"))
If pageSize = 0 Then pageSize = 10
Set RecordSet = Server.CreateObject("ADODB .RecordSet ")
RecordSet.PageSize = pageSize
RecordSet.CacheSize = pageSize
RecordSet.CursorLocation = adUseClient
If strPart = "fru" AND NOT strProduct = "all" Then
CommandText = "SELECT COMPONENT_ITEM_NUMBER, COMPONENT_ITEM_DESCRIPTION , [FRU DIRECT AMER], [FRU INDIRECT AMER], [SVC MFG LIST], [SVC RET FRUS CORE CREDIT], ASSEMBLY_ITEM_NUMBER, TOP_ITEM_NUMBER, COMPONENT_ITEM_LONG_DESC, SEG=CASE WHEN OM_CAT_SEGMENT1='FRUS (FIELD REPLACEABLE PARTS)' THEN 'YES' ELSE 'NO' END, COM=CASE WHEN ltrim(rtrim(COMPONENT_ITEM _LONG_DESC )) = '' THEN 'N/A' ELSE isnull(COMPONENT_ITEM_LONG _DESC, 'N/A') END FROM vIFC_SRV_PART_PRICE_LIST_8 04 WHERE TOP_ITEM_NUMBER = '" & strProduct & "' ORDER BY " & strSort & ""
ElseIf strPart = "urp" AND NOT strProduct = "all" Then
CommandText = "SELECT COMPONENT_ITEM_NUMBER, COMPONENT_ITEM_DESCRIPTION , [ACCY AND URP DIRECT AMER], [ACCY AND URP INDIRECT AMER], [SVC MFG LIST], ASSEMBLY_ITEM_NUMBER, TOP_ITEM_NUMBER, SEG=CASE WHEN OM_CAT_SEGMENT1='FRUS (FIELD REPLACEABLE PARTS)' THEN 'YES' ELSE 'NO' END, COM=CASE WHEN ltrim(rtrim(COMPONENT_ITEM _LONG_DESC )) = '' THEN 'N/A' ELSE isnull(COMPONENT_ITEM_LONG _DESC, 'N/A') END FROM vIFC_SRV_PART_PRICE_LIST_8 11 WHERE TOP_ITEM_NUMBER = '" & strProduct & "' ORDER BY " & strSort & ""
ElseIf strPart = "optional" AND NOT strProduct = "all" Then
CommandText = "SELECT COMPONENT_ITEM_NUMBER, COMPONENT_ITEM_DESCRIPTION , [ACCY AND URP DIRECT AMER], [SVC MFG LIST], ASSEMBLY_ITEM_NUMBER, TOP_ITEM_NUMBER, SEG=CASE WHEN OM_CAT_SEGMENT1='FRUS (FIELD REPLACEABLE PARTS)' THEN 'YES' ELSE 'NO' END, COM=CASE WHEN ltrim(rtrim(COMPONENT_ITEM _LONG_DESC )) = '' THEN 'N/A' ELSE isnull(COMPONENT_ITEM_LONG _DESC, 'N/A') END FROM vIFC_SRV_PART_PRICE_LIST_8 12 WHERE TOP_ITEM_NUMBER = '" & strProduct & "' ORDER BY " & strSort & ""
ElseIf strPart = "all" AND NOT strProduct="all" Then
CommandText = "SELECT COMPONENT_ITEM_NUMBER, COMPONENT_ITEM_DESCRIPTION , [FRU DIRECT AMER], [FRU INDIRECT AMER], [ACCY AND URP INDIRECT AMER], [ACCY AND URP DIRECT AMER], [SVC MFG LIST], [SVC RET FRUS CORE CREDIT], ASSEMBLY_ITEM_NUMBER, TOP_ITEM_NUMBER, SEG=CASE WHEN OM_CAT_SEGMENT1='FRUS (FIELD REPLACEABLE PARTS)' THEN 'YES' ELSE 'NO' END, COM=CASE WHEN ltrim(rtrim(COMPONENT_ITEM _LONG_DESC )) = '' THEN 'N/A' ELSE isnull(COMPONENT_ITEM_LONG _DESC, 'N/A') END FROM vIFC_SRV_PART_PRICE_LIST_A LL WHERE TOP_ITEM_NUMBER = '" & strProduct & "' ORDER BY " & strSort & ""
ElseIf strPart = "fru" AND strProduct = "all" Then
CommandText = "SELECT COMPONENT_ITEM_NUMBER, COMPONENT_ITEM_DESCRIPTION , [FRU DIRECT AMER], [FRU INDIRECT AMER], [SVC MFG LIST], [SVC RET FRUS CORE CREDIT], ASSEMBLY_ITEM_NUMBER, TOP_ITEM_NUMBER, SEG=CASE WHEN OM_CAT_SEGMENT1='FRUS (FIELD REPLACEABLE PARTS)' THEN 'YES' ELSE 'NO' END, COM=CASE WHEN ltrim(rtrim(COMPONENT_ITEM _LONG_DESC )) = '' THEN 'N/A' ELSE isnull(COMPONENT_ITEM_LONG _DESC, 'N/A') END FROM vIFC_SRV_PART_PRICE_LIST_8 04 ORDER BY " & strSort & ""
ElseIf strPart = "urp" AND strProduct = "all" Then
CommandText = "SELECT COMPONENT_ITEM_NUMBER, COMPONENT_ITEM_DESCRIPTION , [ACCY AND URP DIRECT AMER], [ACCY AND URP INDIRECT AMER], [SVC MFG LIST], ASSEMBLY_ITEM_NUMBER, TOP_ITEM_NUMBER, SEG=CASE WHEN OM_CAT_SEGMENT1='FRUS (FIELD REPLACEABLE PARTS)' THEN 'YES' ELSE 'NO' END, COM=CASE WHEN ltrim(rtrim(COMPONENT_ITEM _LONG_DESC )) = '' THEN 'N/A' ELSE isnull(COMPONENT_ITEM_LONG _DESC, 'N/A') END FROM vIFC_SRV_PART_PRICE_LIST_8 11 ORDER BY " & strSort & ""
ElseIf strPart = "optional" AND strProduct = "all" Then
CommandText = "SELECT COMPONENT_ITEM_NUMBER, COMPONENT_ITEM_DESCRIPTION , [ACCY AND URP DIRECT AMER], [SVC MFG LIST], ASSEMBLY_ITEM_NUMBER, TOP_ITEM_NUMBER, SEG=CASE WHEN OM_CAT_SEGMENT1='FRUS (FIELD REPLACEABLE PARTS)' THEN 'YES' ELSE 'NO' END, COM=CASE WHEN ltrim(rtrim(COMPONENT_ITEM _LONG_DESC )) = '' THEN 'N/A' ELSE isnull(COMPONENT_ITEM_LONG _DESC, 'N/A') END FROM vIFC_SRV_PART_PRICE_LIST_8 12 ORDER BY " & strSort & ""
ElseIf strPart = "all" AND strProduct = "all" Then
CommandText = "SELECT COMPONENT_ITEM_NUMBER, COMPONENT_ITEM_DESCRIPTION , [FRU DIRECT AMER], [FRU INDIRECT AMER], [ACCY AND URP DIRECT AMER], [ACCY AND URP INDIRECT AMER], [SVC MFG LIST], [SVC RET FRUS CORE CREDIT], ASSEMBLY_ITEM_NUMBER, TOP_ITEM_NUMBER, SEG=CASE WHEN OM_CAT_SEGMENT1='FRUS (FIELD REPLACEABLE PARTS)' THEN 'YES' ELSE 'NO' END, COM=CASE WHEN ltrim(rtrim(COMPONENT_ITEM _LONG_DESC )) = '' THEN 'N/A' ELSE isnull(COMPONENT_ITEM_LONG _DESC, 'N/A') END FROM vIFC_SRV_PART_PRICE_LIST_A LL ORDER BY " & strSort & ""
End If
RecordSet.Open CommandText, cmdDC, 2, 2, 1
numPages = RecordSet.PageCount
numRecs = RecordSet.RecordCount
If recPage > numPages Then recPage = numPages
If recPage 1 Then recPage = 1
End If
aProducts = Array("product1", "product2", "product3", "product4", "product5")
%>
HTML>
HEAD>
SCRIPT LANGUAGE="JavaScript">
!--
function sortHandler(sort){
var URL = document.sort.site.options [document. sort.site. selectedIn dex].value ;
window.location.href = URL;
}
// -->
/SCRIPT>
/HEAD>
BODY>
table border="0" cellpadding="3" cellspacing="0" width="100%">
tr>
td>font face="arial, helvetica" size="2">b>Select Product/b>/font>/td>
td colspan="2">font face="arial, helvetica" size="2">b>Select Parts Type/b>/font>/td>
% If (strProduct = "" OR strPart = "") OR (strProduct = "error" OR strPart = "error") OR (numRecs = "" OR numRecs = 0) Then %>
td colspan="2">font face="arial, helvetica" size="2">b>Search For A Part Number/b>/font>/td>
% Else %>
td>font face="arial, helvetica" size="2">b>Sort By/b>/font>/td>
% End If %>
/tr>
tr>
form action="index.asp" method="get">
td>
select name="product">
option% If strProduct = "error" Then Response.Write " selected" End If %> value="error">small>Choose a product ->/small>/option>
option% If strProduct = "all" Then Response.Write " selected" End If %> value="all">small>All Products/small>/option>
% For i = 0 To ubound(aProducts) %>
option% If strProduct = aProducts(i) Then Response.Write " selected" End If %> value="%=aProducts(i)%>">% =aProducts (i)%>/opti on>
% Next %>
/select>
/td>
td valign="top">
select name="parts">
option% If strPart = "error" Then Response.Write " selected" End If %> value="error">small>Choose a parts type ->/small>/option>
option% If strPart = "all" Then Response.Write " selected" End If %> value="all">small>All Parts/small>/option>
option% If strPart = "fru" Then Response.Write " selected" End If %> value="fru">small>FRU Parts/small>/option>
option% If strPart = "urp" Then Response.Write " selected" End If %> value="urp">small>UR Parts/small>/option>
option% If strPart = "optional" Then Response.Write " selected" End If %> value="optional">small>Opt ional Accessories/small>/option>
/select>
/td>
td>
input type="submit" value="SUBMIT" onfocus="this.blur()">
/td>
/form>
% If (strProduct = "" OR strPart = "") OR (strProduct = "error" OR strPart = "error") OR (numRecs = "" OR numRecs = 0) Then %>
form action="results.asp" method="get">
td>
input type="text" size="10" maxlength="11" name="part" onfocus="if(this.value=='x xx-xxxx-xx ')this.val ue='';" onblur="if(this.value=='') this.value ='xxx-xxxx -xx';" value="xxx-xxxx-xx">
/td>
td>
input type="submit" value="SUBMIT" onfocus="this.blur()">
/td>
/form>
% End If %>
% If NOT (strProduct = "" OR strPart = "") AND NOT (strProduct = "error" OR strPart = "error") AND NOT (numRecs = "" OR numRecs = 0) Then
%>
form name="sort">
td>
select name="site" size=1 onchange="javascript:sortH andler()">
option% If strSort = "COMPONENT_ITEM_NUMBER ASC" Then Response.Write " selected" End If %> value="index.asp?product=% =strProduc t%>&parts= %=strPart% >&sort=num eric%20asc ">small>Pa rt Number ->!--↑-->/small>/opt ion>
option% If strSort = "COMPONENT_ITEM_NUMBER DESC" Then Response.Write " selected" End If %> value="index.asp?product=% =strProduc t%>&parts= %=strPart% >&sort=num eric%20des c">small>P art Number <-!--↓-->/small>/opt ion>
option% If strSort = "COMPONENT_ITEM_DESCRIPTIO N ASC" Then Response.Write " selected" End If %> value="index.asp?product=% =strProduc t%>&parts= %=strPart% >&sort=alp ha%20asc"> small>Desc ription A-Z/small>/option>
option% If strSort = "COMPONENT_ITEM_DESCRIPTIO N DESC" Then Response.Write " selected" End If %> value="index.asp?product=% =strProduc t%>&parts= %=strPart% >&sort=alp ha%20desc" >small>Des cription Z-A/small>/option>
/select>
/td>
/form>
% End If %>
% If NOT (strProduct = "" OR strPart = "") AND NOT (strProduct = "error" OR strPart = "error") AND NOT (numRecs = "" OR numRecs = 0) Then %>
form action="download.asp" method="post">
td>
img src='/pix/spacer.gif' width='5' height='1'>
input type="image" value="PRINTER-FRIENDLY" src="/pix/printer_small.gi f" width="16" height="16" border="0">
input type="hidden" name="product" value="%=strProduct%>">
input type="hidden" name="part" value="%=strPart%>">
/td>
/form>
% End If %>
/tr>
/table>
%
If strProduct = "" AND strPart = "" Then
Response.Write("p>font face='arial, helvetica' size='2'>Select a product and parts type from the select menus above and click "submit"./font>/p>")
Else If strProduct = "error" OR strPart = "error" Then
Response.Write("p>font face='arial, helvetica' size='2'>b>You must select a product and a parts type from the menus to generate a list.
You may select 'All Products' or 'All Parts' to generate a list for all products or parts./b>/font>/p>")
Else
Response.Write ("
")
Response.Flush
If strPart = "fru" AND RecordSet.BOF AND RecordSet.EOF Then
Response.Write("p>font face='arial, helvetica' size='2'>b>There are no FRU parts for the " & strProduct & " at this time./b>/font>/p>")
Else If strPart = "urp" AND RecordSet.BOF AND RecordSet.EOF Then
Response.Write("p>font face='arial, helvetica' size='2'>b>There are no UR parts for the " & strProduct & " at this time./b>/font>/p>")
Else If strPart = "optional" AND RecordSet.BOF AND RecordSet.EOF Then
Response.Write("p>font face='arial, helvetica' size='2'>b>There are no optional accessories for the " & strProduct & " at this time./b>/font>/p>")
Else
RecordSet.AbsolutePage = recPage
For i = 1 To pageSize
If NOT RecordSet.EOF Then
Response.Write("table border='0' cellpadding='3' cellspacing='0' width='100%'>")
If strSort = "COMPONENT_ITEM_NUMBER ASC" OR strSort = "COMPONENT_ITEM_NUMBER DESC" Then
Response.Write("tr>")
Response.Write("td width='20%'>font face='arial, helvetica' size='2'>b>Part Number/b>/font>/td>" &_
"td>font face='arial, helvetica' size='2'>b>" & RecordSet.Fields("COMPONEN T_ITEM_NUM BER") & "/b>/font>/td>")
Response.Write("/tr>")
Response.Write("tr>")
Response.Write("td width='20%'>font face='arial, helvetica' size='2'>b>Description/b>/ font>/td>" &_
"td>font face='arial, helvetica' size='2'>" & RecordSet.Fields("COMPONEN T_ITEM_DES CRIPTION") & "/font>/td>")
Response.Write("/tr>")
Else If strSort = "COMPONENT_ITEM_DESCRIPTIO N ASC" OR strSort = "COMPONENT_ITEM_DESCRIPTIO N DESC" Then
Response.Write("tr>")
Response.Write("td width='20%'>font face='arial, helvetica' size='2'>b>Description/b>/ font>/td>" &_
"td>font face='arial, helvetica' size='2'>" & RecordSet.Fields("COMPONEN T_ITEM_DES CRIPTION") & "/font>/td>")
Response.Write("/tr>")
Response.Write("tr>")
Response.Write("td width='20%'>font face='arial, helvetica' size='2'>b>Part Number/b>/font>/td>" &_
"td>font face='arial, helvetica' size='2'>b>" & RecordSet.Fields("COMPONEN T_ITEM_NUM BER") & "/b>/font>/td>")
Response.Write("/tr>")
End If
End If
If Mid(RecordSet.Fields("ASSE MBLY_ITEM_ NUMBER"), 1, 3) = "804" Then
Response.Write("tr>")
Response.Write("td width='20%'>font face='arial, helvetica' size='2'>b>Returnable?/b>/ font>/td>" &_
"td>font face='arial, helvetica' size='2'>" & RecordSet.Fields("SEG") & "/font>/td>")
Response.Write("/tr>")
End If
If Mid(RecordSet.Fields("ASSE MBLY_ITEM_ NUMBER"), 1, 3) = "804" AND Session("Company") = "apti" OR Session("Company") = "ahearn" OR Session("Company") = "bax" OR Session("Company") = "kodak" OR Session("Company") = "dhl/elc" OR Session("Company") = "data exchange" OR Session("Company") = "free electronica" Then
Response.Write("tr>")
Response.Write("td width='20%'>font face='arial, helvetica' size='2'>b>Price/b>/font>/ td>" &_
"td>font face='arial, helvetica' size='2'>$" & RecordSet.Fields("FRU DIRECT AMER") & ".00/font>/td>")
Response.Write("/tr>")
ElseIf Mid(RecordSet.Fields("ASSE MBLY_ITEM_ NUMBER"), 1, 3) = "804" AND Session("Company") = "services" OR Session("Company") = "projector doctor" OR Session("Company") = "" AND Session("IP") = "209.84.97.250" OR Session("Company") = "" AND Session("IP") = "209.84.97.254" Then
Response.Write("tr>")
Response.Write("td width='20%'>font face='arial, helvetica' size='2'>b>FSC/ISC Price/b>/font>/td>" &_
"td>font face='arial, helvetica' size='2'>$" & RecordSet.Fields("FRU DIRECT AMER") & ".00/font>/td>")
Response.Write("/tr>")
Response.Write("tr>")
Response.Write("td width='20%'>font face='arial, helvetica' size='2'>b>ASC Price/b>/font>/td>" &_
"td>font face='arial, helvetica' size='2'>$" & RecordSet.Fields("FRU INDIRECT AMER") & ".00/font>/td>")
Response.Write("/tr>")
ElseIf Mid(RecordSet.Fields("ASSE MBLY_ITEM_ NUMBER"), 1, 3) = "804" Then
Response.Write("tr>")
Response.Write("td width='20%'>font face='arial, helvetica' size='2'>b>Price/b>/font>/ td>" &_
"td>font face='arial, helvetica' size='2'>$" & RecordSet.Fields("FRU INDIRECT AMER") & ".00/font>/td>")
Response.Write("/tr>")
ElseIf Mid(RecordSet.Fields("ASSE MBLY_ITEM_ NUMBER"), 1, 3) = "811" AND Session("Company") = "apti" OR Session("Company") = "ahearn" OR Session("Company") = "bax" OR Session("Company") = "kodak" OR Session("Company") = "dhl/elc" OR Session("Company") = "data exchange" OR Session("Company") = "free electronica" Then
Response.Write("tr>")
Response.Write("td width='20%'>font face='arial, helvetica' size='2'>b>Price/b>/font>/ td>" &_
"td>font face='arial, helvetica' size='2'>$" & RecordSet.Fields("ACCY AND URP DIRECT AMER") & ".00/font>/td>")
Response.Write("/tr>")
ElseIf Mid(RecordSet.Fields("ASSE MBLY_ITEM_ NUMBER"), 1, 3) = "811" AND Session("Company") = "services" OR Session("Company") = "projector doctor" OR Session("Company") = "" AND Session("IP") = "209.84.97.250" OR Session("Company") = "" AND Session("IP") = "209.84.97.254" Then
Response.Write("tr>")
Response.Write("td width='20%'>font face='arial, helvetica' size='2'>b>FSC/ISC Price/b>/font>/td>" &_
"td>font face='arial, helvetica' size='2'>$" & RecordSet.Fields("ACCY AND URP DIRECT AMER") & ".00/font>/td>")
Response.Write("/tr>")
Response.Write("tr>")
Response.Write("td width='20%'>font face='arial, helvetica' size='2'>b>ASC Price/b>/font>/td>" &_
"td>font face='arial, helvetica' size='2'>$" & RecordSet.Fields("ACCY AND URP INDIRECT AMER") & ".00/font>/td>")
Response.Write("/tr>")
ElseIf Mid(RecordSet.Fields("ASSE MBLY_ITEM_ NUMBER"), 1, 3) = "811" Then
Response.Write("tr>")
Response.Write("td width='20%'>font face='arial, helvetica' size='2'>b>Price/b>/font>/ td>" &_
"td>font face='arial, helvetica' size='2'>$" & RecordSet.Fields("ACCY AND URP INDIRECT AMER") & ".00/font>/td>")
Response.Write("/tr>")
ElseIf Mid(RecordSet.Fields("ASSE MBLY_ITEM_ NUMBER"), 1, 3) = "812" Then
Response.Write("tr>")
Response.Write("td width='20%'>font face='arial, helvetica' size='2'>b>Price/b>/font>/ td>" &_
"td>font face='arial, helvetica' size='2'>$" & RecordSet.Fields("ACCY AND URP DIRECT AMER") & ".00/font>/td>")
Response.Write("/tr>")
End If
Response.Write("tr>")
Response.Write("td width='20%'>font face='arial, helvetica' size='2'>b>List Price/b>/font>/td>" &_
"td>font face='arial, helvetica' size='2'>$" & RecordSet.Fields("SVC MFG LIST") & ".00/font>/td>")
Response.Write("/tr>")
If Mid(RecordSet.Fields("ASSE MBLY_ITEM_ NUMBER"), 1, 3) = "804" AND NOT RecordSet.Fields("SEG") = "NO" Then
Response.Write("tr>")
Response.Write("td width='20%'>font face='arial, helvetica' size='2'>b>Return Credit/b>/font>/td>" &_
"td>font face='arial, helvetica' size='2'>$" & RecordSet.Fields("SVC RET FRUS CORE CREDIT") & ".00/font>/td>")
Response.Write("/tr>")
End If
If strPart = "all" Then
If Mid(RecordSet.Fields("ASSE MBLY_ITEM_ NUMBER"), 1, 3) = "804" Then
strPartType = "Field Replaceable Unit (FRU)"
Else If Mid(RecordSet.Fields("ASSE MBLY_ITEM_ NUMBER"), 1, 3) = "811" Then
strPartType = "User Replaceable (UR) Part"
Else If Mid(RecordSet.Fields("ASSE MBLY_ITEM_ NUMBER"), 1, 3) = "812" Then
strPartType = "Optional Accessory"
End If
End If
End If
Response.Write("tr>")
Response.Write("td width='20%'>font face='arial, helvetica' size='2'>b>Part Type/b>/font>/td>" &_
"td>font face='arial, helvetica' size='2'>" & strPartType & "/font>/td>")
Response.Write("/tr>")
End If
If strProduct = "all" Then
Response.Write("tr>")
Response.Write("td width='20%'>font face='arial, helvetica' size='2'>b>Used On/b>/font>/td>" &_
"td>font face='arial, helvetica' size='2'>" & RecordSet.Fields("TOP_ITEM _NUMBER") & "/font>/td>")
Response.Write("/tr>")
End If
Response.Write("tr>")
Response.Write("td width='20%' valign='top'>font face='arial, helvetica' size='2'>b>Comments/b>/fon t>/td>" &_
"td>font face='arial, helvetica' size='2'>" & RecordSet.Fields("COM") & "/font>/td>")
Response.Write("/tr>")
Response.Write("/table>")
RecordSet.MoveNext
If NOT RecordSet.EOF Then
Response.Write("table border='0' cellpadding='0' cellspacing='5' width='100%'>")
Response.Write("tr>")
Response.Write("td bgcolor='#339900' height='1' colspan='2'>img src='/pix/spacer.gif' height='1'>/td>")
Response.Write("/tr>")
Response.Write("/table>")
End If
End If
Next
RecordSet.Close
Set RecordSet = Nothing
End If
End If
End If
End If
End If
If NOT numRecs = "" AND NOT numRecs = 0 Then
%>
form name="recsform" action="index.asp?%=Reques t.Serverva riables("Q UERY_STRIN G")%>" method="post">
p>!--font face="arial, helvetica" size="2">%=numRecs%> Records/font>
-->
font face="arial, helvetica" size="2">Show /font>
select name="recs" onchange="updateBoxes(recs form)">
% If numRecs 10 Then %>
option value="%=numRecs%>">%=numR ecs%>/opti on>
% End If %>
% If numRecs >= 10 Then %>
option% If pageSize = 10 Then Response.Write " selected" End If %> value="10">10/option>
% End If %>
% If numRecs >= 25 Then %>
option% If pageSize = 25 Then Response.Write " selected" End If %> value="25">25/option>
% End If %>
% If numRecs >= 50 Then %>
option% If pageSize = 50 Then Response.Write " selected" End If %> value="50">50/option>
% End If %>
% If numRecs >= 100 Then %>
option% If pageSize = 100 Then Response.Write " selected" End If %> value="100">100/option>
% End If %>
% If numRecs = 100 AND NOT numRecs 10 Then %>
option% If pageSize = numRecs Then Response.Write " selected" End If %> value="%=numRecs%>">All/op tion>
% End If %>
/select>
font face="arial, helvetica" size="2"> records per page/font>
!--font face="arial, helvetica" size="2">Page %=recPage%> of %=numPages%>/font>
-->
font face="arial, helvetica" size="2">Display page /font>
!--select name="page">
option>/option>
option>/option>
option>/option>
option>/option>
option>/option>
option>/option>
option>/option>
option>/option>
/select>-->
select name="page">
% For ingPage = 1 To numPages %>
option% If ingPage=recPage Then Response.Write " selected" %> value="%=ingPage%>">%=ingP age%>/opti on>
% Next %>
/select>
input type="submit" value="GO" onfocus="this.blur()">/p>
/form>
SCRIPT LANGUAGE="JavaScript">
!--
NUM_RECORDS = %=numRecs%>;
function updateBoxes(theFormObj)
{
var selectedRecs = theFormObj.recs.options[th eFormObj.r ecs.select edIndex].v alue;
var numpages = Math.ceil(NUM_RECORDS / selectedRecs);
var numOptions = theFormObj.page.length;
for(var i=0 ; inumOptions ; i++){
theFormObj.page.options[0] = null;
}
for(var j=0 ; jnumpages ; j++){
theFormObj.page.options[j] = new Option(j+1,j+1);
}
theFormObj.page.selectedIn dex = 0;
}
updateBoxes(document.recsf orm);
// -->
/SCRIPT>
%
End If
cmdDC.Close
Set cmdDC = Nothing
%>
p> /p>
/BODY>
/HTML>
I changed the your variable from 1ngPage to ingPage because when I tried to use 1ngpage, it would give me an "Expected identifier" error. I figured an i looks like a 1 so that's why I used that. Anyway, the page loads and everything and the "page" select menu is popuated with valid choices and everything but it still does not write "selected" to the option you choose when it takes you to that page. Weird. Anyway, here is the code as it exists now in case I have done anything wrong:
% @ LANGUAGE="VBScript" %>
% Option Explicit %>
!--#INCLUDE VIRTUAL="/service/asc/auth
%
Response.Expires = 0
Response.Buffer = True
Server.ScriptTimeout = 360
Const adOpenForwardOnly = 0
Const adLockReadOnly = 1
Const adUseClient = 3
Const adCmdText = 1
Dim cmdDC, RecordSet, DataConnection, CommandText, i, strProduct, strPart, strSort, recPage, numPages, numRecs, pageSize, ingPage, strPartType, aProducts
DataConnection = "DRIVER=SQL Server;SERVER=MYSERVER;DAT
Set cmdDC = Server.CreateObject("ADODB
cmdDC.Open DataConnection
strProduct = Request.Querystring("produ
strPart = Request.Querystring("parts
strSort = Request.Querystring("sort"
If strSort = "" Then
strSort = "COMPONENT_ITEM_NUMBER ASC"
ElseIf strSort = "numeric asc" Then
strSort = "COMPONENT_ITEM_NUMBER ASC"
ElseIf strSort = "numeric desc" Then
strSort = "COMPONENT_ITEM_NUMBER DESC"
ElseIf strSort = "alpha asc" Then
strSort = "COMPONENT_ITEM_DESCRIPTIO
ElseIf strSort = "alpha desc" Then
strSort = "COMPONENT_ITEM_DESCRIPTIO
End If
If NOT (strProduct = "" AND strPart = "") AND NOT (strProduct = "error" OR strPart = "error") Then
recPage = CInt(Request.Form("page"))
If recPage=0 Then recPage=1
pageSize = CInt(Request.Form("recs"))
If pageSize = 0 Then pageSize = 10
Set RecordSet = Server.CreateObject("ADODB
RecordSet.PageSize = pageSize
RecordSet.CacheSize = pageSize
RecordSet.CursorLocation = adUseClient
If strPart = "fru" AND NOT strProduct = "all" Then
CommandText = "SELECT COMPONENT_ITEM_NUMBER, COMPONENT_ITEM_DESCRIPTION
ElseIf strPart = "urp" AND NOT strProduct = "all" Then
CommandText = "SELECT COMPONENT_ITEM_NUMBER, COMPONENT_ITEM_DESCRIPTION
ElseIf strPart = "optional" AND NOT strProduct = "all" Then
CommandText = "SELECT COMPONENT_ITEM_NUMBER, COMPONENT_ITEM_DESCRIPTION
ElseIf strPart = "all" AND NOT strProduct="all" Then
CommandText = "SELECT COMPONENT_ITEM_NUMBER, COMPONENT_ITEM_DESCRIPTION
ElseIf strPart = "fru" AND strProduct = "all" Then
CommandText = "SELECT COMPONENT_ITEM_NUMBER, COMPONENT_ITEM_DESCRIPTION
ElseIf strPart = "urp" AND strProduct = "all" Then
CommandText = "SELECT COMPONENT_ITEM_NUMBER, COMPONENT_ITEM_DESCRIPTION
ElseIf strPart = "optional" AND strProduct = "all" Then
CommandText = "SELECT COMPONENT_ITEM_NUMBER, COMPONENT_ITEM_DESCRIPTION
ElseIf strPart = "all" AND strProduct = "all" Then
CommandText = "SELECT COMPONENT_ITEM_NUMBER, COMPONENT_ITEM_DESCRIPTION
End If
RecordSet.Open CommandText, cmdDC, 2, 2, 1
numPages = RecordSet.PageCount
numRecs = RecordSet.RecordCount
If recPage > numPages Then recPage = numPages
If recPage 1 Then recPage = 1
End If
aProducts = Array("product1", "product2", "product3", "product4", "product5")
%>
HTML>
HEAD>
SCRIPT LANGUAGE="JavaScript">
!--
function sortHandler(sort){
var URL = document.sort.site.options
window.location.href = URL;
}
// -->
/SCRIPT>
/HEAD>
BODY>
table border="0" cellpadding="3" cellspacing="0" width="100%">
tr>
td>font face="arial, helvetica" size="2">b>Select Product/b>/font>/td>
td colspan="2">font face="arial, helvetica" size="2">b>Select Parts Type/b>/font>/td>
% If (strProduct = "" OR strPart = "") OR (strProduct = "error" OR strPart = "error") OR (numRecs = "" OR numRecs = 0) Then %>
td colspan="2">font face="arial, helvetica" size="2">b>Search For A Part Number/b>/font>/td>
% Else %>
td>font face="arial, helvetica" size="2">b>Sort By/b>/font>/td>
% End If %>
/tr>
tr>
form action="index.asp" method="get">
td>
select name="product">
option% If strProduct = "error" Then Response.Write " selected" End If %> value="error">small>Choose
option% If strProduct = "all" Then Response.Write " selected" End If %> value="all">small>All Products/small>/option>
% For i = 0 To ubound(aProducts) %>
option% If strProduct = aProducts(i) Then Response.Write " selected" End If %> value="%=aProducts(i)%>">%
% Next %>
/select>
/td>
td valign="top">
select name="parts">
option% If strPart = "error" Then Response.Write " selected" End If %> value="error">small>Choose
option% If strPart = "all" Then Response.Write " selected" End If %> value="all">small>All Parts/small>/option>
option% If strPart = "fru" Then Response.Write " selected" End If %> value="fru">small>FRU Parts/small>/option>
option% If strPart = "urp" Then Response.Write " selected" End If %> value="urp">small>UR Parts/small>/option>
option% If strPart = "optional" Then Response.Write " selected" End If %> value="optional">small>Opt
/select>
/td>
td>
input type="submit" value="SUBMIT" onfocus="this.blur()">
/td>
/form>
% If (strProduct = "" OR strPart = "") OR (strProduct = "error" OR strPart = "error") OR (numRecs = "" OR numRecs = 0) Then %>
form action="results.asp" method="get">
td>
input type="text" size="10" maxlength="11" name="part" onfocus="if(this.value=='x
/td>
td>
input type="submit" value="SUBMIT" onfocus="this.blur()">
/td>
/form>
% End If %>
% If NOT (strProduct = "" OR strPart = "") AND NOT (strProduct = "error" OR strPart = "error") AND NOT (numRecs = "" OR numRecs = 0) Then
%>
form name="sort">
td>
select name="site" size=1 onchange="javascript:sortH
option% If strSort = "COMPONENT_ITEM_NUMBER ASC" Then Response.Write " selected" End If %> value="index.asp?product=%
option% If strSort = "COMPONENT_ITEM_NUMBER DESC" Then Response.Write " selected" End If %> value="index.asp?product=%
option% If strSort = "COMPONENT_ITEM_DESCRIPTIO
option% If strSort = "COMPONENT_ITEM_DESCRIPTIO
/select>
/td>
/form>
% End If %>
% If NOT (strProduct = "" OR strPart = "") AND NOT (strProduct = "error" OR strPart = "error") AND NOT (numRecs = "" OR numRecs = 0) Then %>
form action="download.asp" method="post">
td>
img src='/pix/spacer.gif' width='5' height='1'>
input type="image" value="PRINTER-FRIENDLY" src="/pix/printer_small.gi
input type="hidden" name="product" value="%=strProduct%>">
input type="hidden" name="part" value="%=strPart%>">
/td>
/form>
% End If %>
/tr>
/table>
%
If strProduct = "" AND strPart = "" Then
Response.Write("p>font face='arial, helvetica' size='2'>Select a product and parts type from the select menus above and click "submit"./font>/p>")
Else If strProduct = "error" OR strPart = "error" Then
Response.Write("p>font face='arial, helvetica' size='2'>b>You must select a product and a parts type from the menus to generate a list.
You may select 'All Products' or 'All Parts' to generate a list for all products or parts./b>/font>/p>")
Else
Response.Write ("
")
Response.Flush
If strPart = "fru" AND RecordSet.BOF AND RecordSet.EOF Then
Response.Write("p>font face='arial, helvetica' size='2'>b>There are no FRU parts for the " & strProduct & " at this time./b>/font>/p>")
Else If strPart = "urp" AND RecordSet.BOF AND RecordSet.EOF Then
Response.Write("p>font face='arial, helvetica' size='2'>b>There are no UR parts for the " & strProduct & " at this time./b>/font>/p>")
Else If strPart = "optional" AND RecordSet.BOF AND RecordSet.EOF Then
Response.Write("p>font face='arial, helvetica' size='2'>b>There are no optional accessories for the " & strProduct & " at this time./b>/font>/p>")
Else
RecordSet.AbsolutePage = recPage
For i = 1 To pageSize
If NOT RecordSet.EOF Then
Response.Write("table border='0' cellpadding='3' cellspacing='0' width='100%'>")
If strSort = "COMPONENT_ITEM_NUMBER ASC" OR strSort = "COMPONENT_ITEM_NUMBER DESC" Then
Response.Write("tr>")
Response.Write("td width='20%'>font face='arial, helvetica' size='2'>b>Part Number/b>/font>/td>" &_
"td>font face='arial, helvetica' size='2'>b>" & RecordSet.Fields("COMPONEN
Response.Write("/tr>")
Response.Write("tr>")
Response.Write("td width='20%'>font face='arial, helvetica' size='2'>b>Description/b>/
"td>font face='arial, helvetica' size='2'>" & RecordSet.Fields("COMPONEN
Response.Write("/tr>")
Else If strSort = "COMPONENT_ITEM_DESCRIPTIO
Response.Write("tr>")
Response.Write("td width='20%'>font face='arial, helvetica' size='2'>b>Description/b>/
"td>font face='arial, helvetica' size='2'>" & RecordSet.Fields("COMPONEN
Response.Write("/tr>")
Response.Write("tr>")
Response.Write("td width='20%'>font face='arial, helvetica' size='2'>b>Part Number/b>/font>/td>" &_
"td>font face='arial, helvetica' size='2'>b>" & RecordSet.Fields("COMPONEN
Response.Write("/tr>")
End If
End If
If Mid(RecordSet.Fields("ASSE
Response.Write("tr>")
Response.Write("td width='20%'>font face='arial, helvetica' size='2'>b>Returnable?/b>/
"td>font face='arial, helvetica' size='2'>" & RecordSet.Fields("SEG") & "/font>/td>")
Response.Write("/tr>")
End If
If Mid(RecordSet.Fields("ASSE
Response.Write("tr>")
Response.Write("td width='20%'>font face='arial, helvetica' size='2'>b>Price/b>/font>/
"td>font face='arial, helvetica' size='2'>$" & RecordSet.Fields("FRU DIRECT AMER") & ".00/font>/td>")
Response.Write("/tr>")
ElseIf Mid(RecordSet.Fields("ASSE
Response.Write("tr>")
Response.Write("td width='20%'>font face='arial, helvetica' size='2'>b>FSC/ISC Price/b>/font>/td>" &_
"td>font face='arial, helvetica' size='2'>$" & RecordSet.Fields("FRU DIRECT AMER") & ".00/font>/td>")
Response.Write("/tr>")
Response.Write("tr>")
Response.Write("td width='20%'>font face='arial, helvetica' size='2'>b>ASC Price/b>/font>/td>" &_
"td>font face='arial, helvetica' size='2'>$" & RecordSet.Fields("FRU INDIRECT AMER") & ".00/font>/td>")
Response.Write("/tr>")
ElseIf Mid(RecordSet.Fields("ASSE
Response.Write("tr>")
Response.Write("td width='20%'>font face='arial, helvetica' size='2'>b>Price/b>/font>/
"td>font face='arial, helvetica' size='2'>$" & RecordSet.Fields("FRU INDIRECT AMER") & ".00/font>/td>")
Response.Write("/tr>")
ElseIf Mid(RecordSet.Fields("ASSE
Response.Write("tr>")
Response.Write("td width='20%'>font face='arial, helvetica' size='2'>b>Price/b>/font>/
"td>font face='arial, helvetica' size='2'>$" & RecordSet.Fields("ACCY AND URP DIRECT AMER") & ".00/font>/td>")
Response.Write("/tr>")
ElseIf Mid(RecordSet.Fields("ASSE
Response.Write("tr>")
Response.Write("td width='20%'>font face='arial, helvetica' size='2'>b>FSC/ISC Price/b>/font>/td>" &_
"td>font face='arial, helvetica' size='2'>$" & RecordSet.Fields("ACCY AND URP DIRECT AMER") & ".00/font>/td>")
Response.Write("/tr>")
Response.Write("tr>")
Response.Write("td width='20%'>font face='arial, helvetica' size='2'>b>ASC Price/b>/font>/td>" &_
"td>font face='arial, helvetica' size='2'>$" & RecordSet.Fields("ACCY AND URP INDIRECT AMER") & ".00/font>/td>")
Response.Write("/tr>")
ElseIf Mid(RecordSet.Fields("ASSE
Response.Write("tr>")
Response.Write("td width='20%'>font face='arial, helvetica' size='2'>b>Price/b>/font>/
"td>font face='arial, helvetica' size='2'>$" & RecordSet.Fields("ACCY AND URP INDIRECT AMER") & ".00/font>/td>")
Response.Write("/tr>")
ElseIf Mid(RecordSet.Fields("ASSE
Response.Write("tr>")
Response.Write("td width='20%'>font face='arial, helvetica' size='2'>b>Price/b>/font>/
"td>font face='arial, helvetica' size='2'>$" & RecordSet.Fields("ACCY AND URP DIRECT AMER") & ".00/font>/td>")
Response.Write("/tr>")
End If
Response.Write("tr>")
Response.Write("td width='20%'>font face='arial, helvetica' size='2'>b>List Price/b>/font>/td>" &_
"td>font face='arial, helvetica' size='2'>$" & RecordSet.Fields("SVC MFG LIST") & ".00/font>/td>")
Response.Write("/tr>")
If Mid(RecordSet.Fields("ASSE
Response.Write("tr>")
Response.Write("td width='20%'>font face='arial, helvetica' size='2'>b>Return Credit/b>/font>/td>" &_
"td>font face='arial, helvetica' size='2'>$" & RecordSet.Fields("SVC RET FRUS CORE CREDIT") & ".00/font>/td>")
Response.Write("/tr>")
End If
If strPart = "all" Then
If Mid(RecordSet.Fields("ASSE
strPartType = "Field Replaceable Unit (FRU)"
Else If Mid(RecordSet.Fields("ASSE
strPartType = "User Replaceable (UR) Part"
Else If Mid(RecordSet.Fields("ASSE
strPartType = "Optional Accessory"
End If
End If
End If
Response.Write("tr>")
Response.Write("td width='20%'>font face='arial, helvetica' size='2'>b>Part Type/b>/font>/td>" &_
"td>font face='arial, helvetica' size='2'>" & strPartType & "/font>/td>")
Response.Write("/tr>")
End If
If strProduct = "all" Then
Response.Write("tr>")
Response.Write("td width='20%'>font face='arial, helvetica' size='2'>b>Used On/b>/font>/td>" &_
"td>font face='arial, helvetica' size='2'>" & RecordSet.Fields("TOP_ITEM
Response.Write("/tr>")
End If
Response.Write("tr>")
Response.Write("td width='20%' valign='top'>font face='arial, helvetica' size='2'>b>Comments/b>/fon
"td>font face='arial, helvetica' size='2'>" & RecordSet.Fields("COM") & "/font>/td>")
Response.Write("/tr>")
Response.Write("/table>")
RecordSet.MoveNext
If NOT RecordSet.EOF Then
Response.Write("table border='0' cellpadding='0' cellspacing='5' width='100%'>")
Response.Write("tr>")
Response.Write("td bgcolor='#339900' height='1' colspan='2'>img src='/pix/spacer.gif' height='1'>/td>")
Response.Write("/tr>")
Response.Write("/table>")
End If
End If
Next
RecordSet.Close
Set RecordSet = Nothing
End If
End If
End If
End If
End If
If NOT numRecs = "" AND NOT numRecs = 0 Then
%>
form name="recsform" action="index.asp?%=Reques
p>!--font face="arial, helvetica" size="2">%=numRecs%> Records/font>
-->
font face="arial, helvetica" size="2">Show /font>
select name="recs" onchange="updateBoxes(recs
% If numRecs 10 Then %>
option value="%=numRecs%>">%=numR
% End If %>
% If numRecs >= 10 Then %>
option% If pageSize = 10 Then Response.Write " selected" End If %> value="10">10/option>
% End If %>
% If numRecs >= 25 Then %>
option% If pageSize = 25 Then Response.Write " selected" End If %> value="25">25/option>
% End If %>
% If numRecs >= 50 Then %>
option% If pageSize = 50 Then Response.Write " selected" End If %> value="50">50/option>
% End If %>
% If numRecs >= 100 Then %>
option% If pageSize = 100 Then Response.Write " selected" End If %> value="100">100/option>
% End If %>
% If numRecs = 100 AND NOT numRecs 10 Then %>
option% If pageSize = numRecs Then Response.Write " selected" End If %> value="%=numRecs%>">All/op
% End If %>
/select>
font face="arial, helvetica" size="2"> records per page/font>
!--font face="arial, helvetica" size="2">Page %=recPage%> of %=numPages%>/font>
-->
font face="arial, helvetica" size="2">Display page /font>
!--select name="page">
option>/option>
option>/option>
option>/option>
option>/option>
option>/option>
option>/option>
option>/option>
option>/option>
/select>-->
select name="page">
% For ingPage = 1 To numPages %>
option% If ingPage=recPage Then Response.Write " selected" %> value="%=ingPage%>">%=ingP
% Next %>
/select>
input type="submit" value="GO" onfocus="this.blur()">/p>
/form>
SCRIPT LANGUAGE="JavaScript">
!--
NUM_RECORDS = %=numRecs%>;
function updateBoxes(theFormObj)
{
var selectedRecs = theFormObj.recs.options[th
var numpages = Math.ceil(NUM_RECORDS / selectedRecs);
var numOptions = theFormObj.page.length;
for(var i=0 ; inumOptions ; i++){
theFormObj.page.options[0]
}
for(var j=0 ; jnumpages ; j++){
theFormObj.page.options[j]
}
theFormObj.page.selectedIn
}
updateBoxes(document.recsf
// -->
/SCRIPT>
%
End If
cmdDC.Close
Set cmdDC = Nothing
%>
p> /p>
/BODY>
/HTML>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
GreenGhost, I'm sorry, I should have caught that myself. Thank you so much for the effort and the help. Of course it works great now! Thank you again. I really do appreciate it.
giladBoker, thank you too for your effort and help. I really appreciate that.
David
giladBoker, thank you too for your effort and help. I really appreciate that.
David
ASKER
BTW, you are definitely right about the typing off the screen thing. It's a real bad habit I need to get out of. :-)
David
David
write this
I this method every time when u change your selection, u send an indication of what page r u using threw the url and when u get it u just ask about the url and place selected on the right selection.
NOTE=you can replace the recordset("page") with an index going from 1-what ever
<select name="rect" onchange="javascript:submi
<%do while recordset.eof=false%>
<option <%if request.queryString("id")=
<%recordset.movenext%>
<%loop%>
</select>
<script language="javascript">
function submitform(){
document.formName.action="
document.formName.submit()
}
</script>