%response.buffer=true%>
<%
colour1=request.cookies("estid")("colour1")
colour2=request.cookies("estid")("colour2")
colour3=request.cookies("estid")("colour3")
sitetitle=request.cookies("estid")("sitetitle")
textstd=request.cookies("estid")("textstd")
textrollover=request.cookies("estid")("textrollover")
custid=request.cookies("estid")("custid")
chkcurr=request.cookies("estid")("chkcurr")
%>
<%
'Control variables For Retreiving Currency Conversion Rates
maxcol=1 'Maximum number of columns. Set to one or greater
maxrow=50 'Maximum number of rows. Set to one or greater
storycharacters=50 'Maximum number of characters in the story text display
databasesource = "crimpproductnew" 'Database source
tablename = "currdetails" 'Table in database source client data
idcol = 0 'Column containing ids
data1 = 1 'Database Column 1
data2 = 2 'Database Column 2
'End control variables. Do not alter any code after this.
%>
<%
'Start table generation
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open databasesource
sql="SELECT * FROM " & tablename & " ORDER BY " & tablename & ".ID ASC;"
Set RS = Conn.Execute(sql)
v=RS.GetRows(1000)
RS.close
Conn.close %>
<% dim shwchkcurr %>
<% if chkcurr ="" then
shwchkcurr="£"
currratio = 1
chkcurr ="GBP"
End if %>
<% if chkcurr = "GBP" then
shwchkcurr="£"
currratio = 1
end if%>
<% if chkcurr = "US$" then
shwchkcurr="$"
currratio = v(data1,row)
end if%>
<% if chkcurr = "Euro" then
shwchkcurr="€"
currratio = v(data2,row)
end if%>
<% if request.querystring("prodname")<>"" then %><% =request.querystring("prodname") %><% else %>CK Tools, Electricians Tools, Cable Connectors, Cable Ties and Cable Management<% end if %> from The Crimp Company
"" then %><% =request.querystring("prodname") %>, <% end if %>CK Tools, Electricians Tools, Cable Connectors, Cable Ties, Cable Management, Crimp Terminals, Crimp Tools, Cable Glands, Cable Joints, Earthing Products, Abiko">
<%
' BEGIN USER CONSTANTS
Dim CONN_STRING
Dim CONN_USER
Dim CONN_PASS
' I'm using a DSN-less connection.
' To use a DSN, the format is shown on the next line:
CONN_STRING = "DSN=crimpproductnew;"
' This DB is unsecured, o/w you'd need to specify something here
CONN_USER = ""
CONN_PASS = ""
' BEGIN RUNTIME CODE
' Declare our vars
Dim iPageSize 'How big our pages are
Dim iPageCount 'The number of pages we get back
Dim iPageCurrent 'The page we want to show
Dim strOrderBy 'A fake parameter used to illustrate passing them
Dim strSQL 'SQL command to execute
Dim objPagingConn 'The ADODB connection object
Dim objPagingRS 'The ADODB recordset object
Dim iRecordsShown 'Loop controller for displaying just iPageSize records
Dim I 'Standard looping var
' Get parameters
iPageSize = 10 ' You could easily allow users to change this
' Retrieve page to show or default to 1
If Request.QueryString("page") = "" Then
iPageCurrent = 1
Else
iPageCurrent = CInt(Request.QueryString("page"))
End If
If Request.QueryString("order") = "" Then
strOrderBy = "srt"
Else
strOrderBy = Request.QueryString("order")
End If
' Build our SQL String using the parameters we just got.
'strSQL = "SELECT * FROM products ORDER BY " & strOrderBy & ";"
'strSQL = "SELECT * FROM products WHERE special = 'Yes' ORDER BY " & strOrderBy & ";"
'strSQL = "SELECT * FROM products WHERE manu = " & request.querystring("manu") & " ORDER BY " & strOrderBy & ";"
'strSQL = "SELECT * FROM products WHERE prodcategory = " & request.querystring("prodcat") & " ORDER BY " & strOrderBy & ";"
'strSQL = "SELECT * FROM products WHERE online='yes' and prodcategory = " & request.querystring("prodcat") & " AND parentcat = " & request.querystring("parentcat") & " ORDER BY " & strOrderBy & ";"
strSQL = "SELECT * FROM products WHERE online='yes' and parentcat = " & request.querystring("parentcat") & " AND subtool = '" & request.querystring("subtool") & "' ORDER BY " & strOrderBy & ";"
' Now we finally get to the DB work...
' Create and open our connection
set objPagingConn=server.createobject("adodb.connection")
objPagingConn.Open "crimpproductnew"
set objPagingRS=server.CreateObject("adodb.recordset")
objPagingRS.CursorLocation=3 'clientside
objPagingRS.CursorType=3 'staticrecordset
objPagingRS.PageSize=ipagesize
objPagingRS.Open strSQL, objPagingConn
' Get the count of the pages using the given page size
iPageCount = objPagingRS.PageCount
iRC = objPagingRS.RecordCount
' If the request page falls outside the acceptable range,
' give them the closest match (1 or max)
If iPageCurrent > iPageCount Then iPageCurrent = iPageCount
If iPageCurrent < 1 Then iPageCurrent = 1
' Check page count to prevent bombing when zero results are returned!
If iPageCount = 0 Then
Response.Write "Currently we do not have any products in this category"
Else
' Move to the selected page
objPagingRS.AbsolutePage = iPageCurrent
' Start output with a page x of n line
%>
<%
' Spacing
Response.Write vbCrLf
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
%>
<%
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
' Loop through our records and ouput 1 row per record
iRecordsShown = 0
Do While iRecordsShown < iPageSize And Not objPagingRS.EOF
Response.Write vbTab & "" & vbCrLf
For I = 0 To objPagingRS.Fields.Count - 142
%>
<%
'Response.Write vbTab & vbTab & "
" & vbCrLf
Next 'I
Response.Write vbTab & "" & vbCrLf
' Increment the number of records we've shown
iRecordsShown = iRecordsShown + 1
' Can't forget to move to the next record!
objPagingRS.MoveNext
Loop
' All done - close table
Response.Write "" & vbCrLf
End If
' Close DB objects and free variables
objPagingRS.Close
Set objPagingRS = Nothing
objPagingConn.Close
Set objPagingConn = Nothing
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
' Show "previous" and "next" page links which pass the page to view
' and any parameters needed to rebuild the query. You could just as
' easily use a form but you'll need to change the lines that read
' the info back in at the top of the script. %>
<% if iPageCount >"1" then %>
All order are carried out according to standard terms and conditions, click here for details
For details on our privacy policy please
click here
<%'BEGIN sub-routine to replace text in a string
sub replacetext (textstringsource, searchfor, replacewithstart, replacewithend, textstringnew, replacemode)
'Replace text in a string
'Replacemode1 replaces front and rear and at the very end
'Replacemode2 replaces only rear and does not add to the very end of the text string
'Replacemode2 can be used to replace ' with '' for example
laststringpos=1
nextstringpos=2
do while instr(laststringpos,textstringsource,searchfor) <> 0
nextstringpos=instr(laststringpos,textstringsource,searchfor)
if replacemode=1 then
textstringnew=textstringnew & replacewithstart & mid(textstringsource,laststringpos,nextstringpos-laststringpos) & replacewithend
end if
if replacemode=2 then
textstringnew=textstringnew & mid(textstringsource,laststringpos,nextstringpos-laststringpos) & replacewithend
end if
laststringpos=nextstringpos+len(searchfor)
loop
if laststringpos <= len(textstringsource) then
if replacemode=1 then
textstringnew=textstringnew & replacewithstart & mid(textstringsource,laststringpos) & replacewithend
end if
if replacemode=2 then
textstringnew=textstringnew & mid(textstringsource,laststringpos)
end if
end if
searchfor=""
replacewithstart=""
replacewithend=""
end sub
'END sub-routine to replace text in a string%>