Forum 

Forum AspNuke.it - Il tuo Portale OpenSource in ASP

Piccola modifica nel mercatino

Autore Messaggio
MagicSoul

Amatore
Amatore
35 Discussioni



Profilo - MagicSoul
23 marzo 2006 alle 21:19:06 Profilo - MagicSoulInvia un messaggio privato Rispondi quotando
Ciao ragazzi,
ho tentato, purtroppo invano, di portare nella ricerca del mercatino, oltre al titolo(già presente) che si cercava, anche la categoria, come titolazione della ricerca.

Questo il codice ma continua a darmi un errore, mi aiutate per favore? In grassetto le aggiunte. in fondo l'errore.

Grazie in anticipo!

Sub DisplaySearchMercatino(parola, categoria)
Dim oCn, oRs, rSQL, oRs1, rSQL1
Dim iLoop, pag, iLine, page
Dim catID, parcor

parcor = Replace(parola,"'","''")

If categoria = "all" Then
rSQL = "SELECT * FROM me_annuncio WHERE (titolo like '%"&parcor&"%' OR testo like '%"&parcor&"%' OR nota like '%"&parcor&"%') AND valido=1"
Else
rSQL = "SELECT * FROM me_annuncio WHERE (titolo like '%"&parcor&"%' OR testo like '%"&parcor&"%' OR nota like '%"&parcor&"%') AND catID="&categoria&" AND valido=1"
End If

rSQL1 = "SELECT categoria FROM me_categoria WHERE id=" & catID & ""

Set oCn = DBConnexion(DB_MERCATINO)
Set oRs = DBPageRecordSet(oCn, rSQL, RecordsPerPagina)
Set oRs1 = DBRecordSet(oCn, rSQL1)

If Not oRs.EOF Then
If page = "" Then
page = 1
End If

catID = categoria
iLine = 1
iLoop = 0
While Not (oRs.EOF Or iLoop = oRs.pagesize)
CreateTopTable "AnnunciTop", "" & UCase(oRs1("categoria")) & " - " & oRs("titolo") & ""
Response.Write GLOBAL_SITE_SUBTABLE & vbCRLF
Response.Write " <tr class=""tablelinemain"">" & vbCRLF
Response.Write " <td width=""120"" align=""center"">" & GetTranslation("LANG_DATA_INS") & "</td>" & vbCRLF
Response.Write " <td width=""120"" align=""center"">" & GetTranslation("LANG_AUTHOR") & "</td>" & vbCRLF
Response.Write " <td width=""50"" align=""center"">" & GetTranslation("LANG_ANN_PHOTO") & "</td>" & vbCRLF
Response.Write " <td align=""left"">" & GetTranslation("LANG_DESCRIPTION") & "</td>" & vbCRLF
Response.Write " <td width=""120"" align=""left"">" & GetTranslation("LANG_MORE_INFO") & "</td>" & vbCRLF
Response.Write " </tr>" & vbCRLF
Response.Write " <tr class=""tableline" & iLine & """>" & vbCRLF
Response.Write " <td width=""120"" align=""center"" valign=""middle"">" & StringToDate(oRs("datainserimento")) & "</td>" & vbCRLF
Response.Write " <td width=""120"" align=""center"" valign=""middle"">" & oRs("login") & "</td>" & vbCRLF
Response.Write " <td width=""50"" align=""center"" valign=""middle"">" & IIf(oRs("immagine")<>"","SI","NO") & "</td>" & vbCRLF
Response.Write " <td align=""left"" valign=""top"">" & CodeMessageEx(oRs("testo"),55, False,False) & "</td>" & vbCRLF
Response.Write " <td width=""120"" align=""left"" valign=""top"" width=""200""><a href=""" & GLOBAL_SITE_URL & GLOBAL_SITE_PATH & "mercatino.asp?do=item&id=" & CStr(oRs("id")) & """ title=""" & GetTranslation("LANG_READ_ANN") & """>" & GetTranslation("LANG_READ_ANN") & "</a>" & vbCRLF
If sPseudo = oRs("login") Or IsAuthorizedBin(ROLE_ADMINISTRATOR) Then
Response.Write " &nbsp;-&nbsp;" & vbCRLF
Response.Write " <a href=""" & GLOBAL_SITE_URL & GLOBAL_SITE_PATH & "mercatino.asp?action=delete&id=" & CStr(oRs("id")) & """ onclick=""Java_Script:return confcanc()"" title=""" & GetTranslation("LANG_DELETE") & """>" & GetTranslation("LANG_DELETE") & "</a></_div>" & vbCRLF
Else
Response.Write " &nbsp;" & vbCRLF
End If
Response.Write " </td>" & vbCRLF
Response.Write " </tr>" & vbCRLF

iLine = ((iLine-1) Xor 1) + 1

Response.Write "</table>" & vbCRLF
CreateBottomTable ""
oRs.MoveNext
iLoop = iLoop + 1
Wend

CreateTopTable "AnnunciPagine", GetTranslation("LANG_PAGES_ANN")
Response.Write GLOBAL_SITE_SUBTABLE & vbCRLF
Response.Write " <tr class=""tableline1"">" & vbCRLF
Response.Write " <td colspan=""3"" align=""left"">Pagine:" & vbCRLF
For pag=1 To iTotalPage
If Trim(Replace(right(Request.ServerVariables("QUERY_STRING"),2),"=","")) = Trim(pag) Then
Response.Write "<a href=""" & GLOBAL_SITE_URL & GLOBAL_SITE_PATH & "mercatino.asp?do=search&parola=" & parola & "&categoria=" & catId & "&page=" & pag & """>["& pag &"]</a>" & vbCRLF
Else
Response.Write "<a href=""" & GLOBAL_SITE_URL & GLOBAL_SITE_PATH & "mercatino.asp?do=search&parola=" & parola & "&categoria=" & catId & "&page=" & pag & """>"& pag &"</a>" & vbCRLF
End If
Next
Response.Write " </td>" & vbCRLF
Response.Write " <td colspan=""2"" align=""right""><a href="""&GLOBAL_SITE_URL & GLOBAL_SITE_PATH&"mercatino.asp"" title=""" & GetTranslation("LANG_BACK_CAT") & """>" & GetTranslation("LANG_BACK_CAT") & "</a></td>" & vbCRLF
Response.Write " </tr>" & vbCRLF
Response.Write "</table>" & vbCRLF
CreateBottomTable ""

Else
CreateTable "Niente", "", GetTranslation("LANG_NO_SEARCH"), ""
DisplayCategorieMercatino
End If
oRs1.Close
Set oRs1 = Nothing

oRs.Close
Set oRs = Nothing
oCn.Close
Set oCn = Nothing

End Sub


ErroreSQL

Microsoft VB Script runtime error '800a01a8'

Object required: 'DBRecordSet(...)'

emu

Moderatore

Esperto
Esperto
1714 Discussioni



Profilo - emu
23 marzo 2006 alle 21:45:18 Profilo - emuInvia un messaggio privato Rispondi quotando
A parte il fatto che questo tipo di problemi si risolve con una "join", ossia con una sola select su piu' tabelle, si vede che tu usi la variabile catID una decina di righe prima di impostarla, quindi risulta vuota e la select sulle categorie fallisce.
Ciao
---------------
development@aspnuke.it
MagicSoul

Amatore
Amatore
35 Discussioni



Profilo - MagicSoul
24 marzo 2006 alle 12:07:06 Profilo - MagicSoulInvia un messaggio privato Rispondi quotando
Grazie emu, non riesco a farla uscire sta categoria, sempre lo stesso errore.
sto usando la stessa cosa anche su altre tabelle, qualè il comando per usare la stessa select? Ma funziona anche dentro altre SUB?

Grazie.
emu

Moderatore

Esperto
Esperto
1714 Discussioni



Profilo - emu
24 marzo 2006 alle 14:11:22 Profilo - emuInvia un messaggio privato Rispondi quotando
Studiare un po' di linguaggio sql e' cosi' faticoso?
Su internet si trovano decine di tutorial, non possiamo fare a tutti un corso di sql (o di asp o di html...).
Queste cose dovreste saperle fare da soli, se volete personalizzare aspnuke.

Ciao


P.S la query sara' di questo tipo:
select tabella1.campo1, tabella2.campo2 from tabella1, tabella2 where tabella1.campo3=tabella2.campo3 and ....

---------------
development@aspnuke.it

Log in

Login
Password
Memorizza i tuoi dati:

Cerca

 

Sostieni AspNuke

Un piccolo gesto per aiutarci a mantenere AspNuke.it online

Promo

MusicWebItalia.it
Video Testi Traduzioni Spot Colonne sonore Accordi e Spartiti gratis.

Visitatori

Visitatori Correnti : 124
Membri : 0 offline Anna

Iscritti

 Utenti: 18940
Ultimo iscritto : glauco
Lista iscritti
Messaggi privati: 3373 Commenti: 2210 Immagini: 39 Downloads: 144 Articoli: 49 Pagine: 101 Siti web: 558 Notizie: 180 Sondaggi: 11 Preferiti: 5685296 Post sui forum: 51195 Libro degli ospiti: 4 Eventi: 7

Versioni

Temi