<%@LANGUAGE="VBSCRIPT"%> Armeria andorrana
    PRESENTACIÓ       ON ESTEM  LINKS D'INTERÉS     APARADOR VIRTUAL    ACTIVITATS  INFORMACIÓ
  " & vbCRLF Else objRS.AbsolutePosition = intPosition 'if necessary, check for blank field values and print blank cell If objRS.Fields("ID") = "" Then Response.Write "" & vbCRLF Else Response.Write "" & vbCrlf End if End if End Sub Function IIF(sExp, sTrue, sFalse) If CBool((sExp)) = True Then IIF = sTrue Else IIF = sFalse End if End Function 'clean up and close the database objRS.Close Set objRS = Nothing End if %>
<% '################################################################################# '## Copyright (C) 1999-2002 - Matt Smith '## '## This program is free software; you can use it and/or '## modify it as you see fit. I only ask that somewhere in your comments, '## (you do comment your programs, don't you?) you keep a reference '## to the original 4GuysFromRolla article which is: '## '## http://www.4guysfromrolla.com/webtech/111899-1.shtml '## '## Matt Smith '## Questions: matt@smitty.net '## PayPal: matt@smitty.net - tipping is appreciated! '################################################################################# Const adOpenStatic = 3 Const adCmdText = &H0001 Const adUseClient = 3 Const TITLE = "Novetats" dim objRS 'Recordset object dim strSQL 'SQL string dim intNumRows 'number of rows in table dim intNumCols 'number of columns in table dim strLayoutType 'whether intSize refers to (C)olumns or (R)ows dim strOrientation 'direction of output: (V)ertical or (H)orizontal dim intNumRecs 'number of records in the database dim intPage 'current page to disply dim intPageSize 'number of records to display on page dim intNumPages 'number of pages dim intRowIndex 'placeholder for current row dim intColIndex 'placeholder for current column dim intPosition 'placeholder for current record intNumRows = 3 intNumCols = 2 strOrientation = "H" 'strLayoutType = UCase(Request("LayoutType")) %> <% 'create recordset object Set objRS = Server.CreateObject("ADODB.Recordset") 'connect via ODBC objRS.ActiveConnection = MM_armeriaandorrana_STRING 'create SQL query strSQL = "SELECT * FROM Novetats ORDER BY ID ASC;" 'response.write strSQL objRS.CursorLocation = adUseClient 'execute SQL statement objRS.Open strSQL, ,adOpenStatic , , adCmdText %> <% If objRS.EOF And objRS.BOF Then %> No hem trobat cap producte a la base de dades. <% else If NOT objRS.EOF AND NOT objRS.BOF Then Dim Ref Ref = objRS.Fields("ID") 'intNumRows = 3 'intNumCols = 2 'strOrientation = "H" intNumRecs = objRS.RecordCount intPage = Request("Page") intPageSize = cint(intNumRows) * cint(intNumCols) objRS.PageSize = intPageSize intNumPages = objRS.PageCount If intPage = "" then intPage = 1 objRS.AbsolutePage = intPage else objRS.AbsolutePage = intPage end if Response.Write "" & vbCRLF 'span the number of columns in the table with the title 'Response.Write "" & vbCrlf 'Response.Write "" & vbCrlf 'Response.Write "" & vbCrlf 'Response.Write "" & vbCrlf 'loop thru table by row For intRowIndex = 1 To intNumRows Response.Write "" & vbCRLF If strOrientation = "V" Then 'intPosition = intRowIndex 'intPosition = ((intPage - 1) * intPageSize) + intColIndex + ((intRowIndex - 1) * intNumCols) 'loop thru table by column For intColIndex = 1 To intNumCols intPosition = ((intPage - 1) * intPageSize) + intRowIndex + ((intColIndex - 1) * intNumRows) PrintRecord 'intPosition = intPosition + intNumRows Next Else'If strOrientation = "H" Then 'loop thru table by column For intColIndex = 1 To intNumCols intPosition = ((intPage - 1) * intPageSize) + intColIndex + ((intRowIndex - 1) * intNumCols) PrintRecord Next End if Response.Write "" & vbCRLF Response.Write "" & vbCrlf Response.Write "" & vbCrlf Response.Write "" & vbCrlf Next Response.Write "
 
" & vbCRLF End if sub PrintRecord 'if position is past EOF print a blank cell If intPosition > intNumRecs Then Response.Write "
" & vbCRLF Response.Write "" & vbCrlf Response.Write "" & vbCrlf Response.Write "" & vbCrlf Response.Write "" & vbCrlf Response.Write "" & vbCrlf Response.Write "" & vbCrlf Response.Write "" & vbCrlf Response.Write "" & vbCrlf Response.Write "
" If objRS.Fields("Imatge") <> "" then Response.Write "" else Response.Write "" End if Response.Write "" If objRS.Fields("Logo_marca") <> "" then Response.Write "" else Response.Write " " End if Response.Write "" & vbCrlf Response.Write "
" & vbCrlf Response.Write "" & vbCrlf Response.Write "" & vbCrlf Response.Write "" & vbCrlf Response.Write "" & vbCrlf Response.Write "" & vbCrlf Response.Write "" & vbCrlf Response.Write "" & vbCrlf Response.Write "" & vbCrlf If objRS.Fields("Marca") <> "" then Response.Write "" & vbCrlf Response.Write "" & vbCrlf Response.Write "
" If objRS.Fields("Arma") <> "" then Response.Write "" Response.Write UCASE(objRS.Fields("Arma")) Response.Write "

" End if If objRS.Fields("Descripcio_cat") <> "" then Response.Write "Descripció:
" Response.Write Replace(objRS.Fields("Descripcio_cat"),Chr(13),"
") End if If objRS.Fields("Caracteristiques_cat") <> "" then Response.Write "
" Response.Write "Característiques:
" Response.Write Replace(objRS.Fields("Caracteristiques_cat"),Chr(13),"
") End if Response.Write "
" & vbCrlf Response.Write "Preu normal: " If (objRS.Fields("Preu_normal") = 0) then Response.Write "a consultar" else Response.Write FormatNumber(objRS.Fields("Preu_normal"),2) & " €" End if Response.Write "
" & vbCrlf Response.Write "Preu oferta: " If (objRS.Fields("Preu_oferta") = "0") then Response.Write "a consultar" else Response.Write FormatNumber(objRS.Fields("Preu_oferta"),2) & " €" End if Response.Write "
" & vbCrlf Response.Write "
" & vbCrlf Response.Write "
Marca: " Response.Write UCASE(objRS.Fields("Marca")) Response.Write "
" else Response.Write "
 
" End if If objRS.Fields("URL_marca") <> "" then Response.Write "" Response.Write objRS.Fields("URL_marca") Response.Write "
" Response.Write ""Consulteu la Web oficial i contacteu amb nosaltres."" else Response.Write " " End if Response.Write "
" & vbCrlf Response.Write "
" & vbCrlf Response.Write "
" Response.Write objRS.Fields("Tipus_cat") Response.Write "" & vbCrlf Response.Write "" & vbCrlf Response.Write "" & vbCrlf Response.Write "" & vbCrlf Response.Write "" & vbCrlf Response.Write "" & vbCrlf Response.Write "
  Més informació
" & vbCrlf Response.Write "
" & vbCrlf Response.Write "
C/ Bra. Riberaygua 33 Andorra la Vella Principat d'Andorra . Telf:(+376) 820 888    Fax: (+376) 860 222