codice:
Try
voce1 = Iacopino.selectFORelementi("select titolo, titolourl, foto, min(prezzo) as prezzov, codice, count(codice) from prodotti,mercante where mercante=nome and codice<>'-' GROUP BY codice order by 6 desc limit 0,15", "", "confrontoprezzi", 0, voce2, "", elencomarche, "OFF", fasce, "off", 0, "")
Catch ex As Exception
End Try
Public Function selectFORelementi(ByVal strsql As String, ByVal pagina As String, ByVal pagina2 As String, ByVal p As Integer, ByRef voce2 As String, ByVal nome As String, ByRef ElencoMarche As String, ByVal divmarca As String, ByRef fasce As String, ByVal divfasce As String, ByVal IdFascia As Integer, ByVal nomeF As String) As String
Dim cella, fotourl, elencoprodotti As String
Dim dadap As OdbcDataAdapter
Dim dset, dset2, dset3 As DataSet
dadap = New OdbcDataAdapter(strsql, objConn)
dset = New DataSet("valori")
dadap.Fill(dset, "valori")
objConn.Close()
cella = ""
Dim i, j As Integer
If divmarca = "ON" Then
CreaRowsMarche(nome, "marca", 6, ElencoMarche, dset)
'elencoprodotti = creaelencoprodotti(dset, 1)
'ElencoMarche = ElencoMarcheProdotti(elencoprodotti, nome, "marca", "titolourl")
End If
Dim foundRows() As DataRow
Dim importiFasce(2) As Integer
Dim Imp1, Imp2, maxPrezzo As Integer
CreaFasce(fasce, nome, dset, 3, "fascia", importiFasce, maxPrezzo)
Dim table As DataTable = dset.Tables("valori")
Dim expression As String
Try
Imp1 = importiFasce(IdFascia - 2)
Catch ex As Exception
Imp1 = 0
End Try
Try
Imp2 = importiFasce(IdFascia - 1)
Catch ex As Exception
Imp2 = maxPrezzo
End Try
expression = "prezzov > " & Imp1 & " and prezzov < " & Imp2 + 5 & ""
foundRows = dset.Tables("valori").Select(expression)
i = p * 30
While i < foundRows.Length And i < ((p + 1) * 30)
fotourl = foundRows(i)(2)
If fotourl = "" Then
fotourl = "nondisponibile.jpg"
End If
' dset2 = selectFROMdataset("select count(titolo) from prodotti where valoriricerca like '% " & dset.Tables("valori").Rows(i).Item(4) & " %' ")
j = 1 'dset2.Tables("valori").Rows(0).Item(0)
If j > 0 And CStr(foundRows(i)(4)).Length > 2 And foundRows(i)(4) <> "-" Then
cella = cella & "[*]<div class='t1'><a href='" & pagina2 & ".aspx?nome=" & HttpContext.Current.Server.UrlEncode(foundRows(i)(4)) & "'>" & Mid(foundRows(i)(0), 1, 55) & "
" & "[img]" & fotourl & "[/img]" & "
Prezzo da €:" & Format(foundRows(i)(3), " #,##0.00") & "
Cod. " & foundRows(i)(4) & "</a></div>"
End If
i = i + 1
End While
voce2 = creaelencopagine(foundRows.Length, pagina, nomeF)
Return cella
End Function