%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 ("page")="1" then %>
<%
'Control variables
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 = "prodcat" 'Table in database source client data
idcol = 0 'Column containing ids
data1 = 1 'Database Column 1
data2 = 2 'Database Column 2
data3 = 3 'Database Column 3
data4 = 4 'Database Column 4
data5 = 5 'Database Column 5
data6 = 6 'Database Column 6
data7 = 7 'Database Column 7
data8 = 8 'Database Column 9
data9 = 9 'Database Column 9
data10 = 10 'Database Column 10
data11 = 11 'Database Column 11
data12 = 12 'Database Column 12
'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;"
'sql="SELECT * FROM " & tablename & " WHERE accept = 'yes' ORDER BY " & tablename & ".name ASC;"
'sql="SELECT * FROM " & tablename & " WHERE parentcat = " & request.querystring("parentcat") & " ORDER BY " & tablename & ".id ASC;"
sql="SELECT * FROM " & tablename & " WHERE ID = " & request.querystring("ID") & " ORDER BY " & tablename & ".id ASC;"
Set RS = Conn.Execute(sql)
v=RS.GetRows(1000)
RS.close
Conn.close %>
<% end if %> <% ' 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 prodcategory= " & request.querystring("prodcategory") & " 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 %>
"
'Response.Write objPagingRS.Fields(I)
'Response.Write "HS | " & 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 %>
For details on our privacy policy please click here
|