|
|
<%
'Control variables
maxcol=4 'Maximum number of columns. Set to one or greater
maxrow=99999 'Maximum number of rows. Set to one or greater
databasesource = "crimpproductnew" 'Database source
tablename = "prodcat" 'Table in database source client data
data0 = 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
'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 & " WHERE shw='yes' ORDER BY " & tablename & ".parentcat, how ASC;"
'sql="SELECT * FROM " & tablename & " ORDER BY " & tablename & ".parentcat ASC;"
Set RS = Conn.Execute(sql)
v=RS.GetRows(1000)
%>
<%thiscat="test"%>
<%thiscat="test2"%>
<%
trackrow=1
trackcol=1
For row = 0 to UBound(v,2) 'iterate through the rows in the variant array %>
<%thiscat=v(data3,row)%>
<% if prevcat<>thiscat then %>
<%showthiscat=thiscat %>
<% else %>
<%showthiscat=""%>
<% end if %>
<% if showthiscat<>"" then %>
<% trackcol = 1
trackrow = trackrow + 1
'if trackrow > maxrow then exit for
%>
<% end if %>
<% if showthiscat<>"" then %>
<%=findit1(showthiscat)%>
| |
<% end if %>
<% if trackcol = 1 then response.write "" %>
<% if v(data6,row)="crimp" then %>
<%=v(data1,row)%>
<% end if %>
<% if v(data6,row)="all" then %>
<%=v(data1,row)%>
<% end if %>
<% if v(data6,row)="tools" then %>
<%=v(data1,row)%>
<% end if %>
<% if v(data6,row)="subtools" then %>
<%=v(data1,row)%>
<% end if %>
|
|
<% if v(data6,row)="crimp" then %>
<% end if %>
<% if v(data6,row)="all" then %>
<% end if %>
<% if v(data6,row)="tools" then %>
<% end if %>
<% if v(data6,row)="subtools" then %>
<% end if %>
|
|
|
<% prevcat=v(data3,row)%>
<%
if trackcol=maxcol then response.write " "
trackcol=trackcol+1
if trackcol > maxcol then
trackcol = 1
trackrow = trackrow + 1
if trackrow > maxrow then exit for
end if
Next %>
|
|
|
|
|
<%
function findit1 (codenum)
set founder=Conn.execute("select * from parentcat where id=" & codenum)
findit1=founder("parentcat")
set founder=nothing
end function %>
<%
RS.close
Conn.close %>
<%
function findittitle(codenum)
foundercalc="The Crimp Company"
set founder=Conn2.execute("select * from pagetitles where pagename='" & codenum &"'")
do while not founder.EOF
foundercalc=founder("title")
founder.movenext
loop
findittitle=foundercalc
set founder=nothing
end function %>
<%'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%>
|